Project

Profile

Help

Bug #2729

closed

On .NET, building a document using doc() is much faster than building it using the API

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

Status:
Rejected
Priority:
Normal
Category:
Performance
Sprint/Milestone:
-
Start date:
2016-04-29
Due date:
% Done:

0%

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

Description

On .NET, building a document using doc() is much faster than building it using the API: 3 minutes rather than 10. I can't see any reason for the difference.

See http://stackoverflow.com/questions/36904075/how-to-increase-the-speed-of-saxon-evaluation-in-c/36912164#36912164

Actions #1

Updated by Michael Kay over 7 years ago

See also the thread started by Emanuel Wlaschitz on the SourceForge saxon-help list in Aug 2016, which might or might not be related.

Actions #2

Updated by O'Neil Delpratt about 7 years ago

  • Status changed from New to Rejected

The slow performance is caused when using the .NET XmlReader to do the parsing. The Push/Pull SAX eventing handling with the .NET XML parser and the Saxon receiver is much slower than using the JAXP xerces parser directly, which is supplied within Saxon.

To force the JAXP parser, you can do the following should work:

evaluator.ContextItem = documentBuilder.Build(new Uri("file:///C://Users//Administrator//Desktop//2GB.xml"));
Actions #3

Updated by Emanuel Wlaschitz about 7 years ago

Is there a similar workaround for in-memory transformations?

We commonly use this overload when we have an existing XDocument and use its CreateReader/CreateWriter methods to feed into DocumentBuilder.Build (usually to transform from one XDocument into an empty one, where we use the resulting document for something else later).

For file-based ones we use Transformer.SetInputStream (which performs well enough even under .NET)

Actions #4

Updated by Michael Kay about 7 years ago

Supplying a Stream rather than a URI will also use the Xerces (JAXP) parser.

Please register to edit this issue

Also available in: Atom PDF