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

Cache Class.forName for permanently loaded classes

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b92
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: