这些是我收集的一些建议,贴出来,希望可以抛砖引玉:) Performance Tips for All Applications:Throw Fewer Exceptions Make Chunky Calls Design with ValueTypes Use AddRange to Add Groups Trim Your Working Set Use For Loops for String Iteration—version 1 Use StringBuilder for Complex String Manipulation Precompile Windows Forms Applications Use Jagged Arrays—Version 1 Keep IO Buffer Size Between 4KB and 8KB Be on the Lookout for Asynchronous IO Opportunities Performance Tips for ASP.NET Applications Cache Aggressively Use Session State Only If You Need To Use View State Only If You Need To Avoid STA COM Batch Compile Remove Unnecessary Http Modules Avoid the Autoeventwireup Feature Encode Using ASCII When You Don't Need UTF Use the Optimal Authentication Procedure
楼上那篇 MSDN 文章是泛泛而谈, 比如第三条 Design with Value Types, 这个就不一定, 在需要大量操作 reference 的时候你传一个 value type (比如 struct) 那么 box 和 unbox 操作恰恰可能构成瓶颈.如果要用 Hashtable 存储数据肯定是很好的方法, 如果数据很大量, 有可能的话可以根据需求将数据分片, 每片设定一个优先级别 (按照访问的频率来动态调整优先级), 只将高优先度的记录储存在 Hashtable 里面.
Performance Tips for All Applications:Throw Fewer Exceptions
Make Chunky Calls
Design with ValueTypes
Use AddRange to Add Groups
Trim Your Working Set
Use For Loops for String Iteration—version 1
Use StringBuilder for Complex String Manipulation
Precompile Windows Forms Applications
Use Jagged Arrays—Version 1
Keep IO Buffer Size Between 4KB and 8KB
Be on the Lookout for Asynchronous IO Opportunities Performance Tips for ASP.NET Applications Cache Aggressively
Use Session State Only If You Need To
Use View State Only If You Need To
Avoid STA COM
Batch Compile
Remove Unnecessary Http Modules
Avoid the Autoeventwireup Feature
Encode Using ASCII When You Don't Need UTF
Use the Optimal Authentication Procedure