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

Class.getRecordComponents is surprisingly slow

    XMLWordPrintable

Details

    Description

      A DESCRIPTION OF THE PROBLEM :
      I was doing some profiling and JFR showed that Class.getRecordComponents() is surprisingly slow. I made a quick jmh test for this. testRecordComponents calls getRecordComponents(). testRecordComponentsCached uses a HashMap to return a cached array of record components. I would expect the call to getRecordComponents on the Class object to be faster than a HashMap lookup - this is static information after all but it's orders of magnitude slower.

      Benchmark Mode Cnt Score Error Units
      MyBenchmark.testRecordComponents thrpt 3 1552733.925 ± 152277.772 ops/s
      MyBenchmark.testRecordComponentsCached thrpt 3 432760682.251 ± 11713860.326 ops/s



      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: