Project

Profile

Help

Bug #3011

closed

Perfomance of shallow copy with namespaces

Added by Michael Kay about 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Sprint/Milestone:
-
Start date:
2016-10-28
Due date:
% Done:

0%

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

Description

This problem from Jorge Williams was unfortunately tagged on to the end of the unrelated issue #2747, I am belatedly giving it its own entry as it has no connection with 2747 other than the fact that both are about performance.

The test case has a source document with hundreds of namespace declarations, and the processing style makes heavy use of shallow copy (xsl:copy). When xsl:copy is applied to an element, by default all the in-scope namespaces are copied. This searches the ancestors of the target node, copying each namespace down the pipeline individually by a call on Receiver.namespace(). Eventually these namespaces hit a NamespaceReducer, whose task is to eliminate redundant namespace declarations, and it finds that nearly all the namespaces are redundant because they have already been declared on the parent element.

For this particular test case, 680 million namespace bindings are being processed by the ComplexContentOutputter, and it is taking nearly 7 minutes; by adding copy-namespaces=no to the xsl:copy instructions, this is reduced to 9 seconds. The performance got substantially worse between 9.3 and 9.4 when integer namespace codes were removed (this was done to reduce contention on the NamePool, and resulted in no performance regression for less unusuall scenarios).

Please register to edit this issue

Also available in: Atom PDF