We are using Umbraco 4.7. I ported a page from XSL to Razor to see if we could get some performance increases. We have a web service that gives us an XML stream for the XSLT code and we were just experimenting to see if we removed that XML conversion and send the data over unconverted and used Razor to process it to create the page, would we be able to get some performance improvements. (wow long sentence).
Anyway my first real coding effort resulted in a page that loaded 5x slower than XSL.
I was able to optimize a bit and tested the various means of getting content/media out of Umbraco and reduced the time to make Razor about even or 5-10% faster. To get the performance improvements I did a Linq join and switched to the MVC-type method described on a blog I found. Basically you implement a controller function and override the Initialize for the page to call it, and get all your data there and keep your rendering/Razor code to just foreach's and if's as much as possible.
I could paste the code but I guess I am just wondering if y'all have seen the same thing, or if you don't care as much about timing down to the millisecond. The XSL page was loading in ~150ms and I got the Razor version down to the 130-150ms range.
Some things I noticed was that uQuery.GetNodesByXPath('/xxx/xxxxx[yyyy='something']') was the fastest method of getting a node by far. The other methods (@Model.XPath etc) were taking 10-15ms and that one took ~5ms.
Also the media retrieval was fastest (again by far) using @Library.MediaById. Examine is not an option for us at the moment.
Anyway I am disappointed because my lead has shelved the conversion, saying it just doesn't buy us much performance for the effort. Would going to Umbraco 5 give us better results on the Razor side? I have no interest in learning/maintaining XSLT in the future, other than what I need to know to port it to Razor :). Yuck.
Razor in v4 can have some performance problems, but you can fix those: http://our.umbraco.org/forum/developers/razor/28479-Razor-menu-performance-(v4). I've developed a couple of websites in both Razor and XSLT in v4 and the performance is the same, but I think that Razor is a lot easier to work with. Haven't tested v5 yet.
Performance vs XSL (Umbraco 4.7)
We are using Umbraco 4.7. I ported a page from XSL to Razor to see if we could get some performance increases. We have a web service that gives us an XML stream for the XSLT code and we were just experimenting to see if we removed that XML conversion and send the data over unconverted and used Razor to process it to create the page, would we be able to get some performance improvements. (wow long sentence).
Anyway my first real coding effort resulted in a page that loaded 5x slower than XSL.
I was able to optimize a bit and tested the various means of getting content/media out of Umbraco and reduced the time to make Razor about even or 5-10% faster. To get the performance improvements I did a Linq join and switched to the MVC-type method described on a blog I found. Basically you implement a controller function and override the Initialize for the page to call it, and get all your data there and keep your rendering/Razor code to just foreach's and if's as much as possible.
I could paste the code but I guess I am just wondering if y'all have seen the same thing, or if you don't care as much about timing down to the millisecond. The XSL page was loading in ~150ms and I got the Razor version down to the 130-150ms range.
Some things I noticed was that uQuery.GetNodesByXPath('/xxx/xxxxx[yyyy='something']') was the fastest method of getting a node by far. The other methods (@Model.XPath etc) were taking 10-15ms and that one took ~5ms.
Also the media retrieval was fastest (again by far) using @Library.MediaById. Examine is not an option for us at the moment.
Anyway I am disappointed because my lead has shelved the conversion, saying it just doesn't buy us much performance for the effort. Would going to Umbraco 5 give us better results on the Razor side? I have no interest in learning/maintaining XSLT in the future, other than what I need to know to port it to Razor :). Yuck.
Umbraco 5 is really slow at the moment compared to XSLT powered Umbraco 4.7. Probably at least 3 times as slow.
Razor in v4 can have some performance problems, but you can fix those: http://our.umbraco.org/forum/developers/razor/28479-Razor-menu-performance-(v4). I've developed a couple of websites in both Razor and XSLT in v4 and the performance is the same, but I think that Razor is a lot easier to work with. Haven't tested v5 yet.
Jeroen
is working on a reply...