On Tue, 21 Apr 2026 06:14:20 GMT, Stuart Marks <[email protected]> wrote:
>> jengebr has updated the pull request incrementally with one additional >> commit since the last revision: >> >> PR feedback - types in putHashMapEntries > > test/micro/org/openjdk/bench/java/util/HashMapConstructorBenchmark.java line > 120: > >> 118: HashMap<BigInteger, Integer> temp = new HashMap<>(source); >> 119: if (temp.size() != mapSize) >> 120: throw new RuntimeException(); > > Interesting. It looks like test code here... but why? After pondering this a > bit I imagine that simply storing the new HashMap into a local and then > overwriting it on the next loop might result in the JIT compiler eliminating > a bunch of dead code, so adding the if-statement and the size check might > defeat this. But I'm kind of guessing here. A comment would be useful; or, > perhaps there's away to prevent the compiler from doing this? Use a > blackhole? Kind of strange to do this in setup code, but maybe it's > appropriate. Yes, it's effectively a blackhole. I'll address via either comment or JMH Blackhole. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28243#discussion_r3117575976
