On Mon, 30 Mar 2026 19:28:37 GMT, jengebr <[email protected]> wrote: >> src/java.base/share/classes/java/util/HashMap.java line 498: >> >>> 496: private void putMapEntries(HashMap<? extends K, ? extends V> src, >>> boolean evict) { >>> 497: if (src.table != null) { >>> 498: for (Node<? extends K, ? extends V> node : src.table) { >> >> This copy of iteration code imo causes future maintenance cost if iteration >> logic needs an update. I would prefer we just do an entry set iteration, and >> comment clearly that this copy of bytecode is for specialize exact type >> profiling (like the comments in #27533) > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28243#discussion_r3011990016
