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.apache.xalan.internal.xsltc.trax.SAX2DOM.characters(char[], int,
int) is calling
com.sun.org.apache.xerces.internal.dom.CharacterDataImpl.appendData(String) and
99.5% of time is spent here.