A bug has been found in this release of JBoss EAP 6 that causes performance issues when attempting to convert large text nodes using the Xalan Transformer. When using the Transfomer to convert a StreamSource to DOMResult, the performance of the Transformer decreases as the size of the character data increases. This is a Known Issue and will be corrected in a later release of the product.
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
character data increases. If you have a 50MB text blob in XML, this will take a very long time to finish.
Code to reproduce:
import java.io.ByteArrayInputStream;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
StringBuilder sb = new StringBuilder();
sb.append("<thing>");
while(sb.length() < 50*1024*1024) { //50MB
sb.append("iunfgq0irg02i4t985023gwhj9eroisghvpoweisvdjâ); //random blob
}
sb.append("</thing>");
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
ByteArrayInputStream bais = new ByteArrayInputStream(sb.toString().getBytes());
StreamSource source = new StreamSource(bais);
DOMResult result = new DOMResult();
transformer.transform(source, result);
Flagged as Known Issue as ticket unresolved at the time of writing the release note.
Comment 5Rostislav Svoboda
2014-07-17 11:45:13 UTC
Verification failed on EAP 6.3.0 ER10 - xalan-2.7.1.redhat-7.jar
xalan-2.7.1.redhat-7.jar has the same poor performance as xalan-2.7.1.redhat-3.jar from EAP 6.2.0 GA
I checked xalan jar file from https://issues.jboss.org/browse/JBPAPP-10994 and its performance in transformation is astonishing.
xalan-2.7.1.redhat-7.jar and xalan-2.7.1.redhat-3.jar
(total time: 4 minutes 14 seconds)
JBPAPP-10994/xalan.jar
(total time: 2 seconds)
I decompiled xalan-2.7.1.redhat-7.jar and commit https://github.com/jboss/xalan-j/pull/2/files is NOT present.
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 character data increases. If you have a 50MB text blob in XML, this will take a very long time to finish. Code to reproduce: import java.io.ByteArrayInputStream; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamSource; StringBuilder sb = new StringBuilder(); sb.append("<thing>"); while(sb.length() < 50*1024*1024) { //50MB sb.append("iunfgq0irg02i4t985023gwhj9eroisghvpoweisvdjâ); //random blob } sb.append("</thing>"); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); ByteArrayInputStream bais = new ByteArrayInputStream(sb.toString().getBytes()); StreamSource source = new StreamSource(bais); DOMResult result = new DOMResult(); transformer.transform(source, result);