On Wed, 21 Aug 2024 22:27:02 GMT, Chen Liang <li...@openjdk.org> wrote:
> Speed up `ConstantPoolBuilder::classEntry(ClassDesc)` by going through > `ClassDesc` comparison and reusing descriptor hash to calculate internal name > hash if possible. No suitable device to run benchmarks so need to find > something to run the new benchmark to ensure things work as intended. test/micro/org/openjdk/bench/jdk/classfile/ConstantPoolBuildingClassEntry.java line 64: > 62: builder = ConstantPoolBuilder.of(); > 63: classDescs = List.of( > 64: CD_Byte, CD_Object, CD_Long.arrayType(), CD_String, > CD_String, CD_Object, CD_Short, Should this include some primitive class descs? I only see wrapper types like `CD_Integer` test/micro/org/openjdk/bench/jdk/classfile/ConstantPoolBuildingClassEntry.java line 91: > 89: public void identicalLookup(Blackhole bh) { > 90: for (int i = 0; i < RUNS; i++) { > 91: int n = random.nextInt(size); Why the randomization here? `Random` can be pretty slow in and off itself, skewing results, and scales poorly. Prefer `ThreadLocalRandom`. `classDescs` look pretty random to begin with, so why not just loop over it once per measurement? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20667#discussion_r1726914428 PR Review Comment: https://git.openjdk.org/jdk/pull/20667#discussion_r1726912737