Project

Profile

Help

Bug #1908

closed

Performance: patterns calling a function in a predicate

Added by Michael Kay over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Sprint/Milestone:
-
Start date:
2013-09-20
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

When an XSLT pattern contains a predicate that calls a function, for example

match="a[is-interesting(.)]"

the pattern is classified and compiled before it is determined that the function returns a boolean. As a result, the compiled form of the pattern assumes that the function is capable of returning an integer, which would make it dependent of the position of the "a" element relative to its siblings. Such "positional" patterns are very expensive to evaluate compared with pure boolean patterns. In the case that led to this bug report, stylesheet execution time increased from around 1 second to around 2 minutes as a result.

A patch is being placed in Subversion. The effect of the patch is to re-evaluate whether the predicate is positional at a later stage of analysis and recompile the pattern if so.


Related issues

Related to Saxon - Bug #1942: Function current should have been resolved at compile timeClosedMichael Kay2013-12-02

Actions
Related to Saxon - Bug #1992: Template pattern incorrectly identified as never matchingClosedMichael Kay2014-01-30

Actions
Actions #1

Updated by O'Neil Delpratt over 10 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.5.1.3

Big fix applied in the Saxon 9.5.1.3 maintenance release.

Actions #2

Updated by Michael Kay over 10 years ago

The original patch was applied to GeneralNodePattern (method analyse()). But it seems the same problem occurs in GeneralPositionalPattern. The class GeneralPositionalPattern handles a more specific class of positional patterns than GeneralNodePattern, specifically those where of the form T[P] where P is a positional predicate and T is a node-test.

A similar patch is therefore being applied to GeneralPositionalPattern.

Please register to edit this issue

Also available in: Atom PDF