U4-9678 - XPath Syntax Parser slowdown

Created by Lee Kelleher 25 Mar 2017, 11:43:57 Updated by Lee Kelleher 12 Sep 2017, 09:37:52

Tags: PR

Subtask of: U4-9609

In the UmbracoXPathPathSyntaxParser internal class, ''which is used internally by MNTP and the NotFoundHandlerHelper'' has a slow root XPath expression.

The [rootXpath string|https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs#L63] is set as "descendant::*[@id={0}]". This is fine for smaller XML documents, but performance degrades on larger XML documents.

Since the current XML content cache has an index on the ID (using XML DTD attributes), the performance could be greatly improved by using the id() function.


Lee Kelleher 25 Mar 2017, 12:53:11

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

Claus Jensen 12 Sep 2017, 08:20:36

Change looks good to me and no tests are broken - confirmed with @zpqrtbnk that he thinks the change is good too, as unfortunately I'm no xpath wizard :) Thanks @leekelleher !

Lee Kelleher 12 Sep 2017, 09:37:52

Awesome, thanks for merging @claus!

Priority: Normal

Type: Performance Problem

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.6.6

Due in version: 7.6.7


Story Points: 1

Cycle: 4