RFR: 8358535: Changes in ClassValue (JDK-8351996) caused a 1-9% regression in Renaissance-PageRank [v2]

Chen Liang liach at openjdk.org
Fri Aug 8 17:55:13 UTC 2025


On Fri, 8 Aug 2025 17:31:52 GMT, Chen Liang <liach at openjdk.org> wrote:

>> JDK-8351996, PR #24043, updated java.lang.ClassValue, but accidentally missed a piece of cache refresh code that is meaningful when the cache is speculatively invalidated by `remove` calls.
>> 
>> This caused a significant regression in the [PageRank](https://github.com/renaissance-benchmarks/renaissance/blob/master/benchmarks/apache-spark/src/main/scala/org/renaissance/apache/spark/PageRank.scala) benchmark, primarily because Scala array creation like `Array.fill` uses `scala.reflect.ClassTag` which uses `ClassValue`, making `ClassValue.get` a hot code path for every array creation.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Rename test
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/classvalue-cache-miss
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/classvalue-cache-miss
>  - Test
>  - Cache miss when remove is called on another class

On a side note, I finished the benchmarks and verified this patch backported to jdk25 eliminates the observed regression. (The pagerank bench cannot run on 26 due to Spark's dependency on the removed jdk.internal Cleaner)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26679#issuecomment-3168856797


More information about the core-libs-dev mailing list