精华网络内容 :http://www.qqread.com/network/
这件事情似乎很无聊,但是没人做,我来做下苦力吧。
以下是一些简单的测试。单位以ms计算。注意里面用到循环的数量有些事1W,有些是100W。
这些记录可以作为编程过程中的一些参考。
测试平台:
奔腾1.6G 双核CPU
1G内存
vs2008 调试环境测试。
| 一、ArrayList (100W,1W) Stopwatch timer = new Stopwatch(); timer.Start(); System.Collections.ArrayList al = new System.Collections.ArrayList(); for (int i = 0; i < 1000000; i++) { al.Add(i); } timer.Stop(); Console.Write(timer.ElapsedMilliseconds.ToString() + "\t"); Stopwatch timer1 = new Stopwatch(); timer1.Start(); for (int i = 0; i < 10000; i++) { al.Contains(i); } timer1.Stop(); Console.WriteLine(timer1.ElapsedMilliseconds.ToString()); 98 775 160 891 107 773 193 769 |
| 二、Hashtable (100W,1W) Stopwatch timer = new Stopwatch(); timer.Start(); System.Collections.Hashtable ht = new System.Collections.Hashtable(); for (int i = 0; i < 1000000; i++) { ht.Add(i, i); } timer.Stop(); Console.Write(timer.ElapsedMilliseconds.ToString() + "\t"); Stopwatch timer1 = new Stopwatch(); timer1.Start(); for (int i = 0; i < 10000; i++) { ht.ContainsKey(i); } timer1.Stop(); Console.WriteLine(timer1.ElapsedMilliseconds.ToString()); } 375 0 673 0 540 0 495 0 把timer1提高到100万(Hashtable (100W,100W)) 389 139 616 277 516 140 610 277 |
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- .NET移动与嵌入式技术 (5990篇文章)
- .NET开发手册 (5687篇文章)
- ASP.NET 2.0 中跨网页提交的三种方法 (34次浏览)
- 数据库进入免费时代市场将重新洗牌 (23次浏览)
- 通过WebService来使用报表 (20次浏览)
- .net中gridview疑难解答 (20次浏览)
- ASP.NET应用程序的三层设计模型 (19次浏览)
- ZedGraph在Asp.net中的应用 (17次浏览)
- 剖析ASP.NET 2.0代码模型 (17次浏览)
- WCF中的发布-订阅服务 (17次浏览)
- ASP.NET最常见错误提示 (16次浏览)
- 微软正式宣布开源.NET Framework (15次浏览)



