ScopedValue performance declines as number of dynamic bindings increases

Andrew Haley aph-open at littlepinkcloud.com
Wed Jun 25 11:22:16 UTC 2025


On 24/06/2025 19:48, Johan Sjolen wrote:
> The problem with removing the loop is that you'll end up measuring the cost of setting up the dynamic bindings, and not really the cost of traversing them. I'm not sure how you can set up the dynamic bindings as setup and have the benchmarked code run within that dynamic context.

Have a look at 
https://github.com/openjdk/jdk/blob/master/test/micro/org/openjdk/bench/java/lang/ScopedValues*.java, 
which does exactly that.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the loom-dev mailing list