Razor slow to render in Debug #899

Closed
jchannon opened this Issue Jan 9, 2013 · 8 comments

Projects

None yet

4 participants

@jchannon
Custodians of the Super-Duper-Happy-Path member

@philjones and @sjonge were waiting 10-20secs for their Razor views to render and @grumpydev came up with the below gist to fix it.

Not sure what the plan is in fixing it in the long run, I'll do a PR if you let me know what you need doing.

https://gist.github.com/4494412

@philjones88

The main problem with this work around is that something is cached so that if you change a cshtml, you have to build/rebuild the Visual Studio solution for the change to show up.

I think @jchannon needs to make his next PR for Nancy fixing this or upgrading to the full Razor engine ;-)

@grumpydev
Custodians of the Super-Duper-Happy-Path member

@philjones88 can you make a small repro project for this please? It is specifically partials that cause it? I'm still at a loss why the per request cache makes any difference :/

@philjones88

@grumpydev

Tried my best, got it to take 2.70 seconds, not really near my 18 seconds but then I have lots of HTML and more on my Model...

https://github.com/philjones88/NancyRazorPerformance

@prabirshrestha

@philjones88 are you using cassette?

@philjones88

@prabirshrestha I was at the time, now switched to squishit. I need to remove all of Grumpys hacks and see if that makes a difference. But we just had another person in Jabbr complaining about the razor speed, so probably cassette was 1-2 at most.

@prabirshrestha

you could try searching in google groups. cassette really did decrease the speed. i have noticed that too.

@grumpydev
Custodians of the Super-Duper-Happy-Path member

Well the real solution to this is file based cache invalidation (in debug at least), but I'm not sure that's going to be coming any time soon, so I was hoping for a quick win.

The thing that confused me the most was hacking it to do a cache per request sped it up massively.. which doesn't make any sense at all unless you're referring to the same partial over and over again.

@grumpydev
Custodians of the Super-Duper-Happy-Path member

Fixed

@grumpydev grumpydev closed this Feb 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment