Bug #2729
closedOn .NET, building a document using doc() is much faster than building it using the API
0%
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.
Updated by Michael Kay over 7 years ago
See also the thread started by Emanuel Wlaschitz emanuel.wlaschitz@hico.com on the SourceForge saxon-help list in Aug 2016, which might or might not be related.
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"));
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)
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