Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 119461 - WI1 (112371): Reuse org.xml.sax.XMLReader when de-serializing Common Base Event XML fragment/document.
Summary: WI1 (112371): Reuse org.xml.sax.XMLReader when de-serializing Common Base Eve...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Slauenwhite CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 112371
  Show dependency tree
 
Reported: 2005-12-06 13:54 EST by Paul Slauenwhite CLA
Modified: 2016-05-05 10:48 EDT (History)
3 users (show)

See Also:


Attachments
EventFormatterPerformancePatch.txt (7.03 KB, text/plain)
2005-12-06 14:18 EST, Paul Slauenwhite CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2005-12-06 13:54:48 EST
WI1 (112371): Reuse org.xml.sax.XMLReader when de-serializing Common Base Event XML fragment/document.

Note: This defect covers work item 1 of enhancement #112371
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=112371) for performance and memory 
improvements for the three producer Common Base Event implementations.

Currently, a new org.xml.sax.XMLReader object is created and configured before a 
Common Base Event XML fragment/document is de-serialized using the EventFormatter 
class in both the EMF and non-EMF Java Common Base Event implementations.  For example, 
the use case of importing a Common Base Event XML log file results in 88.5% of the 
total  for de-serializing the Common Base Event XML log file.  Specifically, 
creating the XML parser during de-serialization accounts for 26% of the total .  
Also, creating the XML reader during de-serialization accounts for 61% of the total .  
Finally, when the XML reader is created during de-serialization, a SAXParser is created and 
initialized accounting for 44% of the total .

Although the test environment is using a JDK (e.g. IBM JDK) that ships 
the Xerces parser, some JDKs (e.g. Sun JDK v1.4.x) ships a proprietary XML 
Parser implementation (e.g. Crimson) which often deviates from the XML Parser 
specification.   For example, although the XML Parser specification specifies 
that "once a parse is complete, an application may reuse the same org.xml.sax.XMLReader 
object, possibly with a different input source", the TPTP and EMF Teams have 
found this not to be entirely correct for all XML Parser implementations.  As 
such, we have opted to create a new instances of the org.xml.sax.XMLReader and 
org.eclipse.hyades.logging.events.cbe.util.SAXEventHandler on each invocation 
of the 
org.eclipse.hyades.logging.events.cbe.util.associationEnginesFromCanonicalXMLDoc
() and org.eclipse.hyades.logging.events.cbe.util.eventsFromCanonicalXMLDoc() 
methods.  

The proposed fix (see attach) contains the overhead of 
synchronizing each call to the above static methods as well as the memory 
consumption of a static lock object.  Ultimately, more investigation is needed 
to determine the residual side affects of the proposed fix (see attach) and 
possibly the design and implementation of an alternative fix to achieve similar 
performance benefits without the high risk of a functional breakage in certain 
run-times. 


Sizing (PW):
 
Design:        0.25 
Code:          0.25 
Test:          0.5 
Documentation: 0.0
-------------------
Total:         1.0
Comment 1 Paul Slauenwhite CLA 2005-12-06 14:18:23 EST
Created attachment 31227 [details]
EventFormatterPerformancePatch.txt
Comment 2 Paul Slauenwhite CLA 2005-12-06 14:20:18 EST
P1 Cannot ship without this enhancement 
normal A problem making a function difficult to use but no special work around 
is required
Comment 3 Paul Slauenwhite CLA 2005-12-06 15:28:40 EST
(In reply to comment #1)
> Created an attachment (id=31227) [edit]
> EventFormatterPerformancePatch.txt

The proposed solution is to cache a static instance of the org.xml.sax.XMLReader object for reuse by all callers when de-serializing Common Base Event XML fragment(s)/document(s).
Comment 4 Paul Slauenwhite CLA 2005-12-20 14:22:45 EST
The following classes have been checked in to HEAD (Hyades):

org.eclipse.hyades.logging.core:

org.eclipse.hyades.logging.events.cbe.util.EventFormatter.java
org.eclipse.hyades.logging.events.cbe.util.tests.EventFormatterTest.java

The following classes have been checked in to HEAD (TPTP), TPTP-4_0_1 and TPTP-4_1_0:

org.eclipse.hyades.logging.core:

org.eclipse.hyades.logging.events.cbe.util.EventFormatter.java
org.eclipse.tptp.logging.events.cbe.util.EventFormatter.java

org.eclipse.hyades.logging.core.tests:

org.eclipse.hyades.logging.core.junit.cbe.util.EventFormatterTest.java
org.eclipse.hyades.logging.core.junit.cbe.emf.util.EventFormatterTest.java


The above JUnit tests have been executed (Windows) using the following JREs:

IBM V1.4.0
IBM V1.4.2
IBM V1.5.0

Sun V1.4.0
Sun V1.4.1
Sun V1.4.2
Comment 5 Paul Slauenwhite CLA 2005-12-21 12:05:50 EST
Verified in CVS.
Comment 6 Paul Slauenwhite CLA 2005-12-21 12:07:21 EST
(In reply to comment #5)
> Verified in CVS.

HEAD (TPTP)
Comment 7 Cindy Maier CLA 2006-01-12 10:11:17 EST
Hi Paul, has this fix been put into the TPTP 3.3.0.2 fix pack?
Comment 8 Paul Slauenwhite CLA 2006-01-12 12:22:39 EST
(In reply to comment #7)
> Hi Paul, has this fix been put into the TPTP 3.3.0.2 fix pack?

Yes since TPTP V3.3.0.2 is a patch release of Hyades (HEAD) (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=119461#c4).
Comment 9 Cindy Maier CLA 2006-01-12 12:32:53 EST
Oh, I see.  So HEAD (Hyades) is for the TPTP 3.3 stream.  Thanks!