Uploaded image for project: 'ODF Toolkit'
  1. ODF Toolkit
  2. ODFTOOLKIT-473

cache alien element and attribute class to make it faster in OdfXMLFactory

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.6.2-incubating
    • 0.6.2-incubating
    • odfdom

    Description

      Hi,

      Class.forName may not be an efficient method. and in <code>org.odftoolkit.odfdom.pkg.OdfXMLFactory    line:153<code> Class, it use Class.forName to find the Element/Atrribute Class. The <code>classCache</code> map make it better to find the Class. But we need a cache for Alien Element/Atrribute Class too, otherwise it will find the same alien Class by Class.forName again and again. It take too much of CPU cycle.

      It show you in the attachment which a snapshot by JProfiler.It call the Class.forName 39459 times to find the same Class.

      And this is my pull request in GitHub: https://github.com/apache/odftoolkit/pull/3

      Regards.

      ravenq.

      Attachments

        1. test-case-befor-fix.png
          75 kB
          fanliwen
        2. test-case-after-fix.png
          79 kB
          fanliwen
        3. alien-performance-jprofiler.png
          150 kB
          fanliwen

        Activity

          People

            svanteschubert Svante Schubert
            ravenq fanliwen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: