Bug 517962

Summary: Improve Model Conversion Performance
Product: [Automotive] Sphinx Reporter: Andreas Graf <graf>
Component: CoreAssignee: Project Inbox <sphinx-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: balazs.grill
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard:
Attachments:
Description Flags
Mem-Efficient-Dom-Factory
none
XMLString-REader none

Description Andreas Graf CLA 2017-06-07 13:31:58 EDT
Created attachment 268797 [details]
Mem-Efficient-Dom-Factory

Model Conversion for large (i.e. AUTOSAR models) has a few setbacks:

org.eclipse.sphinx.emf.resource.AbstractModelConverter.convertSave(XMLString, int, URI, OutputStream, String, XMLHelper, Map<?, ?>)

* uses two Threads to serialize the XMLString and read it back into a DOM structure.
* The JDOM factory that is being used does not do string deduplication.

Suggested are the follwing changes:

* Use the attached XMLStringReader implementation and
* Use the attached InterningJDOMFactory

The lines from 
PipedInputStream pipedInputStream = new PipedInputStream();
to
final Document document = new SAXBuilder() ....

can just be replaced with

final Document document = new SAXBuilder().build(new XMLStringReader(xml));

No more threading involved.

As a 2nd step, we use the new JDOM factory by replacing the line above with

	SAXBuilder builder = new SAXBuilder();
			builder.setFactory(new InterningJDOMFactory());
			final Document document = builder.build(new XMLStringReader(xml));
I think both files should go into package org.eclipse.sphinx.emf.resource
Comment 1 Andreas Graf CLA 2017-06-07 13:32:31 EDT
Created attachment 268798 [details]
XMLString-REader
Comment 2 Balazs Grill CLA 2024-05-07 00:53:44 EDT
Closed stale issue before migration