Setting debug=false actually causing far SLOWER rendering?

后端 未结 1 848
一生所求
一生所求 2021-01-13 16:09

I\'ve got a strange problem; normally when you set debug=false in your web.config file and compile your web application in Release mode, it increases performanc

相关标签:
1条回答
  • 2021-01-13 16:47

    Short answer: the problem was Microsoft.AspNet.Web.Optimization beta2; it is doing something extremely inefficient and will add a second onto your page rendering time. If you're using it, upgrade. Now.


    I took Steven's advice and used MiniProfiler to see what was causing the slowdown in the view. It was the System.Web.Optimization.Scripts.Render() rendering of the jQuery UI JS:

    Rendering time before

    As per the advice of this question (also, this question seems to address the issue), I upgraded:

    PM> Update-Package Microsoft.AspNet.Web.Optimization
    Updating 'Microsoft.AspNet.Web.Optimization' from version '1.0.0-beta2' to '1.0.0' in project 'Bacp.Assess.Web'.
    

    This upgrades both Microsoft.AspNet.Web.Optimization and WebGrease. Here's the same page after I upgraded:

    Rendering time after

    Uhm. :-) I just knocked 99.9% off the rendering time of the page. Other pages on my site are rendering a lot quicker too. I don't know what Microsoft.AspNet.Web.Optimization beta2 was doing but it's like a ball and chain around ASP.NET!

    0 讨论(0)
提交回复
热议问题