Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

Thursday, June 11, 2015

Sitecore and GlassMapper - how much a GlassCast<> costs

We are using the GlassMapper on many projects, I just want to know how it affects performance.
I have about 20000 Items for testing (Articles) with about 20 fields, in first code I use the GlassCast to get Titles:


items.Select(item => item.GlassCast<Article>()).Select(art => art.Title).ToList();



In second part I will use the field directly:


items.Select(item => item[Article.TitleFieldName]).ToList();



In first case, when we use the GlassCast average time was 00:00:55.23 In second case average time was 00:00:00.034

It's almost 2000 times faster, so we should use it carefully!