最近在做一些关于CLR起动时间优化的东西.随便扯两句.
先说大的.
Rico Mariani, CLR的Performance Architecture, 在他的blog里提到Performance Culture, http://blogs.msdn.com/ricom/archive/2003/12/02/40779.aspx
总结起来对开发者来说有两点.
1.测量. 包括选择什么样的测试程序,怎么样测试.测试一定要自动化,并且一定要有数字结果.这样才能知道你是改进了,还是退步了.
2. 知识.你应该知道什么API耗时长,什么API耗时短.这样你才能选择正确的API.
他认为Performance Culture应该包括三个部分:
1.预算, 指的是产品推出的时候,应该有什么样的features,应该有什么样的performance.
2.计划, 有了一个预算之后,应该有个计划来怎么分配预算.
3.证实, 必须通过测量来保证始终在预算里.如果有超出预算的,应该毫不留情地砍掉.
就我自己的感受
1. LoadLibrary很慢,能不用尽量不要用.
2.文件访问很慢,任何文件访问的减少都是胜利
3.Registry的访问也很慢,特别是RegOpenKey.如果你有很多数据在Registry里,尽量放在同一个Registry Key下面.
我的情况里没有网络.你的情况很可能不一样.
C5 http://www.itu.dk/research/c5/
C5 is a library of generic collection classes for the upcoming version 2.0 of the .Net platform. C5 extends the standard .Net System.Collections.Generic namespace with tree data structures, heap based priority queues and hash indexed array lists and linked lists, making it more comprehensive than most collection class libraries on similar platforms. Unlike many other collection class libraries, C5 is designed with a strict policy of supporting "code to interface not implementation".
之所以看到那么多的Collection,我想还是因为.Net framework现在没有提供完整的数据结构.我的intern就向我抱怨说.Net framework 1.1里没有linkedList和Tree.
Jeffrey Richter和他的在Wintellect的朋友开始了一个Open Source的项目
PowerCollectiolns
http://www.wintellect.com/powercollections/
他们的目的是要实现更多的.Net Collection.
数据结构这种东西,作为一个社区项目可能更合理一些.
也许大家都知道了.MSN刚刚推出了网络版的MSN Messenger.
http://webmessenger.msn.com
在我的英文blog上发表了一篇关于Domain Neutral Assemblies的文章.
http://blogs.msdn.com/junfeng/archive/2004/08/05/208375.aspx
很抱歉没有中文版.如果谁有兴趣帮忙的话不胜感激.
这是mitbbs.com上一个网友业余时间的一个项目.我觉得非常值得敬佩.
http://www.infinite-3d.com/