首页 > 编程 > .NET > 正文

.NET 应用程序的性能提升应用技巧

2024-07-10 13:11:19
字体:
来源:转载
供稿:网友
  • 网站运营seo文章大全
  • 提供全面的站长运营经验及seo技术!
  • 最近花了很多时间研究.net性能提升问题,在ms的网站上也找到很多不错的资料,下面这些内容估计大家或多或少的用过一些,在这里贴出来,希望能对大家的工作有所帮助。

    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
           

     

    appendix: cost of virtual calls and allocations
    call type # calls/sec
    valuetype non-virtual call 809971805.600
    class non-virtual call 268478412.546
    class virtual call 109117738.369
    valuetype virtual (obj method) call 3004286.205
    valuetype virtual (overridden obj method) call 2917140.844
    load type by newing (non-static) 1434.720
    load type by newing (virtual methods) 1369.863

    more:http://msdn.microsoft.com/library/en-us/dnpag/html/scalenet.asp?frame=true

    出处:有气质的熊(minbear) blog

    发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表