On Sun, 1 Mar 2026 04:49:25 GMT, Michael Strauß <[email protected]> wrote:
>> The current implementation of `Renderer.getPeerInstance()` looks up mappings >> by concatenating strings to form a combined key: >> >> peer = peerCache.get(name + "_" + unrollCount); >> >> >> This can be improved by not using strings to store the combined key, but >> using a simple `PeerCacheKey` class instead. >> The `Renderer` class then uses a single reusable `PeerCacheKey` object to >> look up mappings, making the lookup allocation-free. > > Michael Strauß has updated the pull request incrementally with one additional > commit since the last revision: > > add test modules/javafx.graphics/src/main/java/com/sun/scenario/effect/impl/Renderer.java line 87: > 85: > 86: public static final String rootPkg = "com.sun.scenario.effect"; > 87: private static final Map<FilterContext, Renderer> rendererMap = new > HashMap<>(1); If this is meant to initialize the map to a size of 1 then `HashMap.newHashMap` should be used. modules/javafx.graphics/src/main/java/com/sun/scenario/effect/impl/Renderer.java line 116: > 114: } > 115: > 116: private final Map<PeerCacheKey, EffectPeer> peerCache = > Collections.synchronizedMap(new HashMap<>(5)); Isn't a `ConcurrentHashMap` a better alternative? ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2091#discussion_r2869055839 PR Review Comment: https://git.openjdk.org/jfx/pull/2091#discussion_r2869059077
