On Mon, 2 Mar 2026 22:14:15 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:
> 
>   review comment

modules/javafx.graphics/src/main/java/com/sun/scenario/effect/impl/Renderer.java
 line 310:

> 308:         synchronized (peerCache) {
> 309:             peers = peerCache.values().toArray(EffectPeer[]::new);
> 310:             peerCache.clear();

So the cache was not cleared before, right? Is there any side effect / negative 
effect we need to be aware of?

Also, can't we just iteratoe over `peerCache.values()` and call dispose on 
every peer, and then clear the `Map`? So we can save the temp `Array`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2091#discussion_r3079015952

Reply via email to