jaxp
  1. jaxp
  2. JAXP-16

Performance issue in com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: current
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      16

      Description

      The constructor reads:

      public SAX2DOM() throws ParserConfigurationException

      { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); _document = factory.newDocumentBuilder().newDocument(); _root = _document; }

      but this is very slow, as DocumentBuilderFactory.newInstance() takes a
      significant time to run, then newDocumentBuilder() takes even more time to run.

      The whole effort is more or less wasted, because all you do is to create a empty
      document, which internally just invokes new
      c.s.o.a.xerces.internal.dom.DocumentImpl()

      I recommend either using a cached DocumentBuilder (synchronizing it shouldn't be
      a problem, or use ThreadLocal), or given that this code is in the JAXP RI, hard
      code JAXP RI's own Document class.

      One of the JAXB users reported that this code alone is taking up more than 60%
      of the entire unmarshalling processing.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            kohsuke
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: