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

        Hide
        kohsuke added a comment -

        Created an attachment (id=5)
        JProfiler profiler data file contributed by the user

        Show
        kohsuke added a comment - Created an attachment (id=5) JProfiler profiler data file contributed by the user
        Hide
        kohsuke added a comment -

        Also see http://forums.java.net/jive/thread.jspa?messageID=206299#206299 for the
        relevant forum discussion.

        Show
        kohsuke added a comment - Also see http://forums.java.net/jive/thread.jspa?messageID=206299#206299 for the relevant forum discussion.
        Show
        Joe Wang added a comment - Resolved in the fix for 6660724 ( http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=7a552d1ebeec66b51d0ec77dba8c?bug_id=6660724 )

          People

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

            Dates

            • Created:
              Updated:
              Resolved: