Skip to content

Instantly share code, notes, and snippets.

@kamsar kamsar/Benchmark.cs
Created Jun 11, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.