.NET应用性能优化中遇到的几个trick
August 17th, 2010
(性能优化…我这一辈子都在做性能优化…)
1. 线程。不要啊不要自己做锁…并行计算首先要让被并行的任务尽量独立,然后只要把任务放进Thread扔出去,在主线程等待子线程完成任务就行了。var thread = new Thread(worker.Execute); thread.Start(); ... thread.Join();
2. 还是线程。然则,.NET的线程是昂贵的,据说一个线程启动需要100毫秒左右,还需要1M左右内存。所以,不能肆无忌惮地开线程…要用 BackgroundWorker …话说,为什么要设计出这种重量级的线程呢…
3. 容器。List
4. 还是容器。List
5. 日志。Log4Net很慢 …真的非常慢…所以只要把大量的log关掉,于是性能就好了…其实最大的优化是这个…
总之,感想是…真的有人用.NET这种东西做什么严肃的应用程序吗?这些东西…设计得也未免太弱智了吧…呃,想起来了,还有一个:
6. 还是日志。胡凯 说,做个小工具吧,统计一下日志里的信息…嗯,我觉得,那个工具应该叫 grep …一个连grep都没有的操作系统啊…
Highlights of WPF
October 28th, 2007
(From the book Windows Presentation Foundation Unleashed)
Broad integration
Resolution independence
Hardware acceleration
Declarative programming
Rich composition and customization
Easy deployment
In short, WPF aims to combine the best attributes of systems such as DirectX (3D and hardware acceleration), Windows Forms (developer productivity), Adobe Flash (powerful animation support), and HTML (declarative markup and easy deployment).



