主题:【倡议】Java SE 5.0和.NET 2.0擂台赛 -- Highway
StringBuiler几乎是一路领先(低端有些交替)!
java -server -Xmx256M StringTest >perf2.txt
String number: 1000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 0ms
String number: 2000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 16ms
String number: 3000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 15ms
String number: 4000
StringBuffer Takes Time: 16ms
StringBuilder Takes Time: 0ms
String number: 5000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 15ms
String number: 6000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 0ms
String number: 7000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 0ms
String number: 8000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 0ms
String number: 9000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 16ms
String number: 10000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 15ms
String number: 11000
StringBuffer Takes Time: 15ms
StringBuilder Takes Time: 0ms
String number: 12000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 0ms
String number: 13000
StringBuffer Takes Time: 0ms
StringBuilder Takes Time: 0ms
String number: 14000
StringBuffer Takes Time: 16ms
StringBuilder Takes Time: 15ms
String number: 15000
StringBuffer Takes Time: 16ms
StringBuilder Takes Time: 16ms
String number: 16000
StringBuffer Takes Time: 16ms
StringBuilder Takes Time: 16ms
String number: 17000
StringBuffer Takes Time: 16ms
StringBuilder Takes Time: 15ms
String number: 18000
StringBuffer Takes Time: 16ms
StringBuilder Takes Time: 15ms
String number: 19000
StringBuffer Takes Time: 31ms
StringBuilder Takes Time: 15ms
String number: 20000
StringBuffer Takes Time: 31ms
StringBuilder Takes Time: 16ms
String number: 21000
StringBuffer Takes Time: 31ms
StringBuilder Takes Time: 16ms
String number: 22000
StringBuffer Takes Time: 31ms
StringBuilder Takes Time: 16ms
String number: 23000
StringBuffer Takes Time: 31ms
StringBuilder Takes Time: 16ms
String number: 24000
StringBuffer Takes Time: 32ms
StringBuilder Takes Time: 15ms
String number: 25000
StringBuffer Takes Time: 32ms
StringBuilder Takes Time: 15ms
String number: 26000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 27000
StringBuffer Takes Time: 32ms
StringBuilder Takes Time: 46ms
String number: 28000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 29000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 32ms
String number: 30000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 31000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 32000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 32ms
String number: 33000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 34000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 47ms
String number: 35000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 32ms
String number: 36000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 47ms
String number: 37000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 47ms
String number: 38000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 47ms
String number: 39000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 47ms
String number: 40000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 47ms
String number: 41000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 16ms
String number: 42000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 43000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 16ms
String number: 44000
StringBuffer Takes Time: 31ms
StringBuilder Takes Time: 31ms
String number: 45000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 46000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 47000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 16ms
String number: 48000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 32ms
String number: 49000
StringBuffer Takes Time: 46ms
StringBuilder Takes Time: 32ms
String number: 50000
StringBuffer Takes Time: 47ms
StringBuilder Takes Time: 31ms
String number: 51000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 63ms
String number: 52000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 63ms
String number: 53000
StringBuffer Takes Time: 63ms
StringBuilder Takes Time: 47ms
String number: 54000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 47ms
String number: 55000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 63ms
String number: 56000
StringBuffer Takes Time: 63ms
StringBuilder Takes Time: 62ms
String number: 57000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 47ms
String number: 58000
StringBuffer Takes Time: 79ms
StringBuilder Takes Time: 62ms
String number: 59000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 63ms
String number: 60000
StringBuffer Takes Time: 63ms
StringBuilder Takes Time: 62ms
String number: 61000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 62ms
String number: 62000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 63ms
String number: 63000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 63ms
String number: 64000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 63ms
String number: 65000
StringBuffer Takes Time: 79ms
StringBuilder Takes Time: 62ms
String number: 66000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 62ms
String number: 67000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 62ms
String number: 68000
StringBuffer Takes Time: 79ms
StringBuilder Takes Time: 62ms
String number: 69000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 78ms
String number: 70000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 63ms
String number: 71000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 63ms
String number: 72000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 62ms
String number: 73000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 62ms
String number: 74000
StringBuffer Takes Time: 78ms
StringBuilder Takes Time: 79ms
String number: 75000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 62ms
String number: 76000
StringBuffer Takes Time: 79ms
StringBuilder Takes Time: 78ms
String number: 77000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 62ms
String number: 78000
StringBuffer Takes Time: 93ms
StringBuilder Takes Time: 63ms
String number: 79000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 62ms
String number: 80000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 63ms
String number: 81000
StringBuffer Takes Time: 125ms
StringBuilder Takes Time: 47ms
String number: 82000
StringBuffer Takes Time: 93ms
StringBuilder Takes Time: 47ms
String number: 83000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 84000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 85000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 86000
StringBuffer Takes Time: 93ms
StringBuilder Takes Time: 47ms
String number: 87000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 88000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 47ms
String number: 89000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 90000
StringBuffer Takes Time: 62ms
StringBuilder Takes Time: 63ms
String number: 91000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 46ms
String number: 92000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 93000
StringBuffer Takes Time: 93ms
StringBuilder Takes Time: 47ms
String number: 94000
StringBuffer Takes Time: 94ms
StringBuilder Takes Time: 47ms
String number: 95000
StringBuffer Takes Time: 110ms
StringBuilder Takes Time: 47ms
String number: 96000
StringBuffer Takes Time: 109ms
StringBuilder Takes Time: 47ms
String number: 97000
StringBuffer Takes Time: 93ms
StringBuilder Takes Time: 63ms
String number: 98000
StringBuffer Takes Time: 109ms
StringBuilder Takes Time: 47ms
String number: 99000
StringBuffer Takes Time: 109ms
StringBuilder Takes Time: 47ms
String number: 100000
StringBuffer Takes Time: 141ms
StringBuilder Takes Time: 93ms
- 相关回复 上下关系8
我对Java StringBuffer/StringBuilder的测试结果 老兵帅客 字21245 2004-10-05 09:41:54
其实这种测试波动很大。因为我们没有办法控制GC. Highway 字639 2004-10-05 10:24:24
理论上的确如此 老兵帅客 字282 2004-10-05 10:40:33
😉看看我的测试结果!
😉你试着再加个-Xms256M,看看结果如何? 老兵帅客 字808 2004-10-05 12:03:36
用不同的参数,运行多次,其结果比较参差。 Highway 字1401 2004-10-05 12:28:40
后天我才有时间对你的这个和下面那个问题进行测试 老兵帅客 字58 2004-10-04 15:19:10
😅串行化/反串行化小测试中Java取得绝对性胜利! Highway 字7765 2004-10-01 16:28:48