Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8141446

Cache Class.forName for permanently loaded classes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-libs
    • None
    • b92
    • generic
    • generic

        I profiled loading of test/script/basic/compile-octane.js; it's one of the longest-taking scripts in our tests. Surprisingly, two large hot spots presented themselves, both calling Class.forName: one in Context.forStructureClass another for Type.typeFor. Since both methods will load classes that will be retained in memory, adding a cache in front of them is a no-brainer. Doing so caused the first-time execution (significant in our tests) to drop from 34s to 28s. Warmed up time from repeating the loading in an infinite loop (not too significant in our case) dropped from 18s to 13s.

        Whole test suite execution also benefits; on my machine it went down from 12m30s to 10m30s.

              attila Attila Szegedi
              attila Attila Szegedi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: