Skip to content

Instantly share code, notes, and snippets.

@kamsar
Created June 11, 2015 13:30
Show Gist options
  • Save kamsar/f2aa92ef3f63f3c7b931 to your computer and use it in GitHub Desktop.
Save kamsar/f2aa92ef3f63f3c7b931 to your computer and use it in GitHub Desktop.
Synthesis mapping performance
var items = Sitecore.Context.Database.GetRootItem().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 displayNamesSynthesis = items.AsStronglyTypedCollection().Select(x => x.DisplayName).ToList();
sw.Stop();
Response.Write("<h1>Synthesis {0}ms</h1>".FormatWith(sw.ElapsedMilliseconds));
5148 Items
SCAPI 20ms
Synthesis 57ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment