Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6652519
Votes 0
Synopsis JAXP issue 48 : Performance Issue with Xalan Transformer
Category jaxp:xslt
Reported Against
Release Fixed 1.4, 6u14(b03) (Bug ID:2173440)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs 6746047 , 2167664 , 2173538
Submit Date 18-JAN-2008
Description
It has been observed that when using the Transfomer to convert a StreamSource to
DOMResult, the performance of Transform gets worse as the size of the
inputstream increases.

How to Reproduce :

The issue manifests in the form of Poor performance of SAAJ for Large Payloads.
SAAJ RI depends on the Transformer.

 import javax.xml.soap.*;

       long start = System.currentTimeMillis();
       MessageFactory mf =
MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
       MimeHeaders hdrs = new MimeHeaders();
       hdrs.addHeader("Content-Type", "application/soap+xml");
       SOAPMessage sm = mf.createMessage(hdrs, new FileInputStream(new
File("msgAttach.xml")));
       SOAPBody body = sm.getSOAPBody();
       long end = System.currentTimeMillis();
       System.out.println("Total Time Taken=" + (end - start)/1000);

Here msgAttach.xml is basically a SOAP Envelope with a large SOAPBody

------------
Profiling has shown that 99.5% of the time is being spent on in
CharacterDataImpl.appendData()

com.sun.org. customer .xalan.internal.xsltc.trax.SAX2DOM.characters(char[], int,
int)  is calling
com.sun.org. customer .xerces.internal.dom.CharacterDataImpl.appendData(String)  and
99.5% of time is spent here.
Posted Date : 2008-01-18 19:23:14.0
Work Around
N/A
Evaluation
As shown in the profiling analysis, SAX2DOM makes calls on CharacterDataImpl.appendData(String) to accumulate text. This is very inefficient since a node is created as a string, every call to appendData results in a string concatenation. The fix is to use a StringBuffer to accumulate text before the node is created using the resulting string.

Simple test on a workstation (Sun Ultra 20) shows a transformation of the provided xml file (436kb) from StreamSource to DOMResult which took over 13 min. before now takes only 172ms after the change.
Posted Date : 2008-01-18 20:29:12.0

The customer has confirmed that the patch fixed the performance problem they had. This patch has also provided a performance improvement for xml transformation. The fix in jaxp 1.4 will also be integrated into future jdk5/6 update releases.
Posted Date : 2008-02-27 23:10:32.0
Comments
  
  Include a link with my name & email   

Submitted On 06-FEB-2009
PaulPeters
We have issues with this at several clients. SOAP invocations get exponentially slower depending on size. When will this bug be implemented ?



PLEASE NOTE: JDK6 is formerly known as Project Mustang