Skip to content

Instantly share code, notes, and snippets.

@GuitarRich
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GuitarRich/7deb0f6eb689d8027c99 to your computer and use it in GitHub Desktop.
Save GuitarRich/7deb0f6eb689d8027c99 to your computer and use it in GitHub Desktop.
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
Copy link

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
Copy link
Author

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