The results from the previous post were from a page which had a few macros on it. In true scientific fashion I decided to isolate the issue. I downloaded a fresh copy of Umbraco from the web matrix and ran it on iis express.
I made a doctype with nothing except a title. I made 2 templates and 2 macroscripts. One using Model, the other using DynamicNode.
Here are the macroscripts:
DynamicNode d = new DynamicNode(Model.Id);
The 2 following images are example traces (Model followed by DynamicNode). I am interested in the time it takes for the macro to finish loading. Ie. the last line Loading IMacroEngine script [done]
Here is a table of results showing the Loading IMacroEngine script [done] line:
Dynamic node loaded on average 0.000041646741092 seconds faster than Model.
This does not seem like much, but it is interesting that instantiating a DynamicNode and getting a value from it is quicker than getting a value from Model. I was told that Model is dynamic but is actually a DynamicNode also. It sort of makes sense that a dynamic object would be more intensive than a typed one (even of the same type).
I'm wondering if there is some sort of effect of having multiple scripts (or nested scripts, or even possibly nested masterpages) on the page which compounds the time taken to load a single macro, and hence causing the script to load slower in the previous post.
I would be interested if people had some input.
I decided to run the tests again except checking if the value is null.
So the difference is larger when you start doing things with Model.