教你50招提升ASP.NET性能(十九):静态集合
2013-07-31 13:52
435 查看
(30)Static collections
招数30:
静态集合
If a collection is static, make sure it only contains the objects you need. If the collection is iterated over often, then the performance can be slow if you don’t remove unnecessary objects. Objects in a collection will be held in memory, even if they have been disposed of, which can also lead to a memory leak.
如果一个集合是静态的,确保它只包含你需要的对象。如果集合经常被遍历,如果你不移除不必要的对象,那么性能可能降低。集合中的对象将会占用内存,这也会导致内存泄漏,即时它们已经被处理过。
招数30:
静态集合
If a collection is static, make sure it only contains the objects you need. If the collection is iterated over often, then the performance can be slow if you don’t remove unnecessary objects. Objects in a collection will be held in memory, even if they have been disposed of, which can also lead to a memory leak.
如果一个集合是静态的,确保它只包含你需要的对象。如果集合经常被遍历,如果你不移除不必要的对象,那么性能可能降低。集合中的对象将会占用内存,这也会导致内存泄漏,即时它们已经被处理过。
相关文章推荐
- 教你50招提升ASP.NET性能(十三):精选技巧集合
- 教你50招提升ASP.NET性能(十八):在处理网站性能问题前,首先验证问题是否出在客户端
- 教你50招提升ASP.NET性能(八):检查你使用了什么客户端脚本
- 教你50招提升ASP.NET性能(十一):避免在调试模式下运行网站
- 教你50招提升ASP.NET性能(四):精选的技巧
- 教你50招提升ASP.NET性能(十):减少通过网络发送的数据
- 教你50招提升ASP.NET性能(二十三):StringBuilder不适用于所有字符串连接的场景;String.Join可能是
- 教你50招提升ASP.NET性能(一):缓存是最后的手段
- 教你50招提升ASP.NET性能(二十六):对于开发人员的数据库性能技巧
- 教你50招提升ASP.NET性能(二):移除不用的视图引擎
- 教你50招提升ASP.NET性能(五):确保分页是在数据层完成的
- 教你50招提升ASP.NET性能(十五):解决性能问题时不要低估UI的价值
- 教你50招提升ASP.NET性能(二十二):利用.NET 4.5异步结构
- 教你50招提升ASP.NET性能(十六):把问题仍给硬件而不是开发人员
- 教你50招提升ASP.NET性能(十七):不要认为问题只会从业务层产生
- 教你50招提升ASP.NET性能(十四):使用startMode属性来减少ASP.NET站点加载时间
- 教你50招提升ASP.NET性能(二十):认识你的循环
- 教你50招提升ASP.NET性能(七):总是在服务器端执行验证
- 教你50招提升ASP.NET性能(十二):在生产环境,仔细考虑你需要记录哪些日志
- 教你50招提升ASP.NET性能(九):显式的使用using语句减少内存泄露