Skip to content

Instantly share code, notes, and snippets.

@GuitarRich

GuitarRich/Benchmark.cs

Last active Aug 29, 2015
Embed
What would you like to do?
Fortis Object Mapper Performance
var items = Sitecore.Context.Database.GetItem(new ID("{1FBCAB2D-8444-43FB-916C-951AE3FA244E}")).Axes.GetDescendants();
Response.Write("<h1>{0} Items</h1>".FormatWith(items.Length));
var sw = new Stopwatch();
sw.Start();
var displayNamesScapi = items.Select(item => item[FieldIDs.DisplayName]).ToList();
sw.Stop();
Response.Write("<h1>SCAPI {0}ms</h1>".FormatWith(sw.ElapsedMilliseconds));
sw.Restart();
var displayNamesFortis = Fortis.Global.SpawnProvider.FromItems<IItemWrapper>(items).Select(item => item.DisplayName).ToList();
sw.Stop();
Response.Write("<h1>Fortis {0}ms</h1>".FormatWith(sw.ElapsedMilliseconds));
4716 Items
SCAPI 5-12ms
Fortis 16-32ms
@kamsar

This comment has been minimized.

Copy link

@kamsar kamsar commented Jun 11, 2015

The code on line 15 isn't reading the display name field, just wrapping the items it looks like?

That said, I'm sure Fortis is also quite fast :)

@GuitarRich

This comment has been minimized.

Copy link
Owner Author

@GuitarRich GuitarRich commented Jun 15, 2015

Nice spot Kam, I completely missed that! I have updated the Gist and results to reflect that!

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment