So I created a solution which you can find here 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.

Share article
See also

MVC renderings with xWrap framework – Sitecore Experience Wrapper

Read more Volodymyr Hil 10.12.2018

Introducing xWrap framework – Sitecore Experience Wrapper

Read more Volodymyr Hil 09.12.2018

A recap from Sitecore Symposium 2018 and MVP summit

Read more Volodymyr Hil 25.10.2018

Using the service bus to transfer messages between instance roles

Read more Volodymyr Hil 10.06.2018

Using Swagger in Sitecore solution as a helix feature

Read more Volodymyr Hil 19.02.2018