主题:【倡议】Java SE 5.0和.NET 2.0擂台赛 -- Highway
来整合一下,做个资料库。wiki可能会是个好手段。
比如期刊, 我感觉用wiki的方式就很好, 主要是
1. 方便大家参与
2. 方便维护
我在database上装了个mediawiki, 有空可以试试看, 感觉一下是
不是好用.
如果把你程序中的a.Add(aObj)换成a.Add(aObj).toString(),我们将得到另外一组数据:
Java without toString()
Serialization and Deserialization of 50*1000 items take:2344 ms.
Serialization and Deserialization of 500*100 items take:438 ms.
Serialization and Deserialization of 5000*10 items take:359 ms.
Serialization and Deserialization of 50000*1 items take:641 ms.
Serialization and Deserialization of 50000*10 items take:11016 ms.
Java with toString()
Serialization and Deserialization of 50*1000 items take:1406 ms.
Serialization and Deserialization of 500*100 items take:297 ms.
Serialization and Deserialization of 5000*10 items take:329 ms.
Serialization and Deserialization of 50000*1 items take:437 ms.
Serialization and Deserialization of 50000*10 items take:35078 ms.
.Net with toString();
Serialization and Deserialization of 50*1000 items take:297 ms.
Serialization and Deserialization of 500*100 items take:234 ms.
Serialization and Deserialization of 5000*10 items take:313 ms.
Serialization and Deserialization of 50000*1 items take:312 ms.
Serialization and Deserialization of 50000*10 items take:4000 ms.
我们可以看出,当不使用toString()的时候,明显是Java占上风,但是当使用toString()的时候,.Net则明显占了上风。看来.Net的问题应该是出在了深层目标的Serialization和Deserialization上面,而不是ArrayList层面。
Exception,Generics等等。
曾近看过一篇文章,作者说尽量要避免在Session中使用自己定义的Ojbect.如果可能,要使用.NET的build-in type。因为自己定义的Object要使用“比较慢”的Binary Formatter来穿行化。而.NET的build-in type就要快很多。
SOAP Formatter我也试验过,比Binary Formatter慢更多。