On Wed, 23 Apr 2025 12:21:21 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

>> 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.

This code has always used getDeclaredField each time so if anyone had run into 
a performance issue then we should have heard by now. So I think keeping the 
changes simple and just moving to Unsafe is okay for now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24821#discussion_r2055960041

Reply via email to