Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2900

Performance issue with Xalan transformer and very large text nodes

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

      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);
      
      Show
      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);
    • Bugzilla Update:
      Perform

      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
      character data increases. If you have a 50MB text blob in XML, this will take a very long time to finish.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jason.greene Jason Greene
                  Reporter:
                  klape Kyle Lape
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: