Last active
August 29, 2015 14:22
-
-
Save GuitarRich/7deb0f6eb689d8027c99 to your computer and use it in GitHub Desktop.
Fortis Object Mapper Performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4716 Items | |
SCAPI 5-12ms | |
Fortis 16-32ms |
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
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 :)