Bug 455288 - Performance bottleneck when deserializing XML documents containing XmlAnyElement mapping with DomHandler
Summary: Performance bottleneck when deserializing XML documents containing XmlAnyElem...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2014-12-15 21:10 EST by Nándor Elöd Fekete CLA
Modified: 2022-06-09 10:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nándor Elöd Fekete CLA 2014-12-15 21:10:32 EST
When the JAXB deserializer encounters a node mapped with XmlAnyElement with DomHandler on a non-DOM property in the input XML, it creates a org.eclipse.persistence.platform.xml.jaxp.JAXPTransformer to process the node. 
org.eclipse.persistence.platform.xml.jaxp.JAXPTransformer.getTransformer() method will lazily create it's underlying transformer delegate by calling org.eclipse.persistence.platform.xml.jaxp.JAXPTransformer.TransformerFactoryHelper.getTransformerFactory().
This method in turn calls javax.xml.transform.TransformerFactory.newInstance() which runs an expensive discovery mechanism to create the TransformerFactory instance, especially with large projects with many jar files on the classpath.

One possible solution would be to cache the TransformerFactory instance once created with javax.xml.transform.TransformerFactory.newInstance()

I don't know yet how to provide a testcase for this, because, for the performance bottleneck to be noticeable, it requires a classpath with many jar files.
Comment 1 Nándor Elöd Fekete CLA 2014-12-15 21:13:08 EST
Just to be clear. The execution of the discovery mechanism happens at every node mapped with XmlAnyElement in the input, that's why it's cumulative cost can get very high depending on the input xml file.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:08:09 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink