JDK 19 |
---|
19 b20Fixed |
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
JDK-8279833 deals with a point fix where moving a method local variable into two separate scope locals avoids a regression introduced by JEP 254. I've attached a JMH benchmark based on a slightly modified version of the pre-JDK-8279833 version of String.encodeUTF8_UTF16 (loopsWithSharedLocal), along with a version with the same patch applied as in JDK-8279833 (loopsWithScopedLocal): Benchmark (negativeStart) Mode Cnt Score Error Units LoopLocals.loopsWithScopedLocal true avgt 2 2828.665 ns/op LoopLocals.loopsWithScopedLocal false avgt 2 1164.918 ns/op LoopLocals.loopsWithSharedLocal true avgt 2 5355.671 ns/op LoopLocals.loopsWithSharedLocal false avgt 2 1164.860 ns/op The interesting case is when we're spending most of the time in the second loop (negativeStart = true). When not splitting the locals this variant is about half as fast. I expect that C2 should be able to act as if the variables were local to each individual scope in general here. I've tried simplifying the benchmark, e.g., by removing the byte[] allocations, but then the issue disappears.
|