I know, I am being annoying about this, but today I’m gonna share more tests. In order to keep this constructive I will attach code that I have been using for my measurements.
So I created a solution which you can find here https://github.com/vhil/fortis-vs-glass-testground. It uses same sitecore instance and both Glass and Fortis were installed there. There is a /testrunner.aspx page which runst tests and drows charts with test results.
As I described in my first post, Glass behaves different way when mapping Sitecore items using interfaces and mapping using classes that implement these interfaces. In case of using TDS and code generation templates we have both interfaces and types generated into the model. Let’s see what is the difference performance-wise in both cases.
In previous post I shared chart which shows performance test results using interface mappings. Basically next chart that I got from my new page shows pretty much same results:
The code for Glass part here is using interfaces when accessing SitecoreService methods like:
var item = SitecoreService.GetItem<INavigation>(contentPageId); var typedItem = item.GlassCast<INavigation>();
Lets see same test cases but replace interface to concrete types for Glass code. So methods above will be executed as:
var item = SitecoreService.GetItem<Navigation>(contentPageId); var typedItem = item.GlassCast<Navigation>();
Well, test results have remarkably changed.
As you can see the Read / Render field cases for Glass now work super fast. But in the same time, the “Get Item” and “Expose From Item” gone a bit crazy. I believe when using types instead of interfaces, the object is being exposed the moment when we getting it from the method with all field values (which is a bit strange), so reading fields turns out to be just reading the object properties. Well, to read the field we still need to execute the slow “Get Item” method so I don’t think we win here.
Probaby that’s it what I wanted to show today.
Now we have the project on github with both Fortis and Glass in it. Apparantly we can play a bit more with Fortis and Glass comparison in terms of building same features using both frameworks.