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 performance. For some pages on my site, it's majorly slowing down the rendering. Here's the page in debug mode:
... and here's that same page in Release mode with debug mode turned OFF:
No, I didn't get those two confused. What on Earth could be causing debug mode to be rendering the page 3 times quicker (if you ignore the controller and SQL performance, it renders the page FIVE times quicker)?! Is there anything obvious I could have misconfigured?
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:
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:
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With