On Fri, 3 Apr 2026 16:51:29 GMT, Stuart Marks <[email protected]> wrote:

>> jengebr has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Addressing CR feedback (formatting + safe casts)
>
> Hi, I finally got some time to dig into this.
> 
> Fundamentally, the performance analysis seems sound. The remedy of peeling 
> off a couple special cases for copying from HashMap also seems sensible. 
> Based on some studies I've seen, HashMap is the second-most used collection, 
> trailing only ArrayList. There are many times when it's necessary to make 
> defensive copies of collections, so optimizing HashMap's copy construction 
> path makes sense. Also, we've been advocating for a long time (with varied 
> success) that objects protect encapsulation by wrapping internal collections 
> with an unmodifiable wrapper, so handling that case too makes a lot of sense.
> 
> I agree with using a specific class check for `HashMap.class` (as opposed to 
> `instanceof HashMap`).
> 
> I have two topics for discussion: 1) how `putMapEntries(Map)` should handle 
> the logic to determine the special case; and 2) how the fast path loop should 
> be implemented. I'll comment on those near the respective pieces of code, or 
> add to existing comment threads.
> 
> Note that I'll be taking off for the long weekend; I'll return midweek next 
> week. Again, sorry for the long delay on this. But we should be able to move 
> forward.

@stuart-marks the new AI check is failing, I'm not sure how to solve that?  I 
added it to the PR description next to other checkboxes but no luck.

It is otherwise rfr.

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

PR Comment: https://git.openjdk.org/jdk/pull/28243#issuecomment-4239089079

Reply via email to