Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting debug=false actually causing far SLOWER rendering?

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:

Debug mode on

... and here's that same page in Release mode with debug mode turned OFF:

Debug mode 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?

like image 226
Jez Avatar asked Feb 17 '23 16:02

Jez


1 Answers

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!

like image 123
Jez Avatar answered Feb 23 '23 15:02

Jez