主题:【倡议】Java SE 5.0和.NET 2.0擂台赛 -- Highway
没有一个一直领先。但大多情况下,StringBuilder要好一些,或者好很多。
java -server -Xms64M -Xmx512M StringTest
StringBuffer Takes Total Time: 1763ms
StringBuilder Takes Total Time: 1127ms
java -server -Xms128M -Xmx256M StringTest
StringBuffer Takes Total Time: 2095ms
StringBuilder Takes Total Time: 952ms
java -server -Xms128M -Xmx512M StringTest
StringBuffer Takes Total Time: 2108ms
StringBuilder Takes Total Time: 888ms
java -server -Xms256M -Xmx512M StringTest
StringBuffer Takes Total Time: 1097ms
StringBuilder Takes Total Time: 1107ms
java -server -Xms512M -Xmx512M StringTest
StringBuffer Takes Total Time: 1235ms
StringBuilder Takes Total Time: 1079ms
缺省下,StringBuilder性能好些。
-Server的连续三次的结果为(总时间):
StringBuffer Takes Total Time: 5857ms
StringBuilder Takes Total Time: 3984ms
StringBuffer Takes Total Time: 5664ms
StringBuilder Takes Total Time: 3996ms
StringBuffer Takes Total Time: 5772ms
StringBuilder Takes Total Time: 3992ms
-Client的连续三次的结果为(总时间):
StringBuffer Takes Total Time: 7748ms
StringBuilder Takes Total Time: 6266ms
StringBuffer Takes Total Time: 7845ms
StringBuilder Takes Total Time: 6425ms
StringBuffer Takes Total Time: 7906ms
StringBuilder Takes Total Time: 6307ms
- 相关回复 上下关系8
理论上的确如此 老兵帅客 字282 2004-10-05 10:40:33
😉看看我的测试结果! Highway 字8579 2004-10-05 11:07:49
😉你试着再加个-Xms256M,看看结果如何? 老兵帅客 字808 2004-10-05 12:03:36
用不同的参数,运行多次,其结果比较参差。
后天我才有时间对你的这个和下面那个问题进行测试 老兵帅客 字58 2004-10-04 15:19:10
😅串行化/反串行化小测试中Java取得绝对性胜利! Highway 字7765 2004-10-01 16:28:48
一件有趣的事情 老兵帅客 字1349 2004-10-07 21:43:31
有些技术,由于设计思想就不同,所以结果就会差别很大。比如 Highway 字289 2004-10-08 06:53:02