On Wed, 23 Apr 2025 10:44:05 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> This Pull Request replaces the uses of Field + setAccessible to modify final >> fields in java.util.concurrent with Unsafe. > > src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java > line 534: > >> 532: U.putReference( >> 533: this, >> 534: U.objectFieldOffset(ConcurrentSkipListSet.class, "m"), > > Would it make sense to compute the offset once and for all and put it in a > `static final long` field? Yeah, I originally did that, but the following patch is the "smallest change". Given that the "original code" obtained the Field instance each call, this is still likely a performance improvement. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24821#discussion_r2055927582