U4-9458 - UmbracoExamine performance optimizations

Created by Shannon Deminick 01 Feb 2017, 04:58:43 Updated by Mikkel Holck Madsen 08 Feb 2017, 14:13:02

Subtask of: UAASSCRUM-790

There's several 'critical' errors in the UmbracoExamine and Examine code that can be optimized and end up showing as hot spots with analyzers.

Most of these are looking up things by a key in a list which can be fixed by looking these things up in indexed collections instead of lists.

2 Attachments

Comments

Shannon Deminick 01 Feb 2017, 04:59:19

First commit: https://github.com/umbraco/Umbraco-CMS/commit/5b2212829c30fdc57e569e5a31273dd4e679c253


Shannon Deminick 01 Feb 2017, 05:52:47

PR: https://github.com/umbraco/Umbraco-CMS/pull/1722

Changes:

  • Changes IndexFieldPolicies to be a KeyedCollection instead of just a list of stuff - there is critical code that looks up values by keys in this list for every document for every field which is a ton of processing. Using Linq to iterate items to find a value is extremely inneficient especially when considering we can easily just have a keyed collection (like a dictionary) with an index == made for speed for this exact thing
  • Changes usages of IndexFieldPolicies to use TryGetValue so that the lookup is as fast as possible
  • Changes the ValidateDocument method to not parse the INT unless it is needed, this also occurs for every document which can be a lot if there is a large index
  • Updates to latest Examine 0.1.81


Mikkel Holck Madsen 06 Feb 2017, 20:47:02

This is merged, and ready for release. Tested with a few different sites, who all have large indexes, really improves speed, and the indexes are having the same content. Great work!


Sebastiaan Janssen 07 Feb 2017, 10:37:20

The zip file was fine, the NuGet version has the wrong dependency though. The NuSpec file wasn't update. I'm automating a check for that now.


Sebastiaan Janssen 07 Feb 2017, 15:28:13

PR: https://github.com/umbraco/Umbraco-CMS/pull/1740

This PR adds unit test to make sure we can not forget to do this any more and updates the Examine (and Markdown(!)) dependency to their correct versions to prove that the unit tests first fail, then succeed.

When AppVeyor completes:

See screenshot for failed test result.


Mikkel Holck Madsen 08 Feb 2017, 14:12:54

This is perfect, great way to ensure the nuspec files.

It seems like it need those 4 digits for ClientDependency now, I also installed from a raw web solution, and that added it as well.


Priority: Normal

Type: Task

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.10

Sprint: Sprint 52

Story Points:

Cycle: