On Mon, 30 Mar 2026 20:16:58 GMT, Stuart Marks <[email protected]> wrote:

>> Will do!
>
> While it's true that an entrySet iteration could reduce future maintenance 
> costs, it might also affect the performance. The monomorphic path seems like 
> it enables better inlining, but the JIT would still have to deal with 
> multiple calls to the Iterator and the getKey/getValue calls. Maybe this 
> means you'll have to rerun the benchmarks to see if performance is equivalent.
> 
> I'm still mulling over the impact of including another table-walking + 
> next-following nested loops in this code. It might not be that bad after all.

Another impact of moving to an entrySet iteration is that the keys' hashCodes 
need to be recomputed instead of being transferred directly from the source 
node. The benchmark uses String keys, which cache their hashCode, so 
recomputation might not show up in the benchmark. But other key types might pay 
a penalty for the recomputation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28243#discussion_r3012660727

Reply via email to