Performance question

Apr 7, 2011 at 8:09 AM

He there,

I have just stared to use razor and have got the simple sample working, but I have a question regarding performance.  I'm logging the time before and after the call to Razor.Parse to get an idea of execution time.  Below is a sample.

Template Generation Start: 50:09:665
Template Generation End: 50:11:595

I find even if the template I'm using is empty or has no Razor markup within it, it still takes 1 second or more to generate.  I was wondering if I have missed something in the setup (I have included the razorengine.dll and system.web.razor.dll in my project and thats about it).

If any one could shed some light on this that would be greatly appreciated.

Coordinator
Apr 7, 2011 at 4:06 PM

Have you checked the performance after the first generation? Compilation and parsing isn't a quick affair. That's one of the reasons razorEngine and the MVC Razor cache the results.

Apr 7, 2011 at 10:52 PM

Thanks for your reply.  I'm using version 2.1.  

I'm just a bit confused that even a blank template takes around the same time to generate as a template with razor in it.

Is there anything I have to do to turn caching on?

Apr 8, 2011 at 7:20 AM

Never mind, I fixed the issue by precompiling the templates.  Thanks again for your help.