On Tue, 31 Mar 2026 12:40:52 GMT, jengebr <[email protected]> wrote:

>> 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.
>
> @stuart-marks I deliberately chose String to minimize the benchmark overhead, 
> but you are exactly right about both the blind spot and the impact of copying 
> the hashcode vs. recreating it.  Good catches.

A revised benchmark using a non-cached hashCode() shows even worse performance 
on the baseline cases, and has zero impact on the optimized case - thus 
highlighting the value of the change.  I'll wait to update the PR and data 
until we have agreement on the details of the fastpath.

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

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

Reply via email to