-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
19, 20, 21
-
generic
-
generic
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
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
- relates to
-
JDK-8225053 Preview APIs support for records
- Resolved