Bug 517962 - Improve Model Conversion Performance
Summary: Improve Model Conversion Performance
Status: CLOSED WONTFIX
Alias: None
Product: Sphinx
Classification: Automotive
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-07 13:31 EDT by Andreas Graf CLA
Modified: 2024-05-07 00:53 EDT (History)
1 user (show)

See Also:


Attachments
Mem-Efficient-Dom-Factory (3.91 KB, application/octet-stream)
2017-06-07 13:31 EDT, Andreas Graf CLA
no flags Details
XMLString-REader (1.36 KB, application/octet-stream)
2017-06-07 13:32 EDT, Andreas Graf CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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