Compiled vs. Interpreted Views

Feb 16, 2010 at 2:35 PM

I did not have the chance to take a look at it, but I have a curiosity regarding the possibility of precompiling/validating the views at development/start time and not after application launch and view access.

Feb 21, 2010 at 6:26 PM
Edited Feb 21, 2010 at 6:28 PM

There are 2 aspects to what you're discussing.  Firstly - keep in mind that every Sharpy function and modifier is already a piece of compiled code.  For example, if you use the foreach function you are simply invoking a piece of compiled code.  It's only the parameters being passed that are evaluated at runtime.  We can't really get around that very easily - the best we could do would be write another intermediate piece of code that we can compile which would in turn reference the necessary compiled functions.  

More importantly would be the benefits or disadvantages of the different approaches.  I did some performance testing to compare Sharpy to the regular view engine - the results were quite interesting.  Sharpy does, as expected, take longer to evaluate a view, but only marginally and, more importantly, both view engines can render a view in far less than a millisecond.  Sharpy does have certain caching functionality - basically the parsed view is stored which does improve performance for large views.

The idea of pre-parsing views at startup is quite interesting - however I think the caching does pretty much the same thing.