On Mon, 24 Feb 2020 11:04:26 GMT, dannygonzalez 
<github.com+6702882+dannygonza...@openjdk.org> wrote:

>> Just wanted to keep a similar behaviour as before using the same calculation 
>> based originally on the size of the listeners array list and now based on 
>> the size of the map. So in theory the weak listeners should be trimmed at 
>> the same rate as before.
>> Happy to hear alternatives.
>
> Also bear in mind that the trimming of weak listeners is extremely slow as it 
> has to iterate through each listener performing the weak listener test. We 
> can't call this every time we add a listener as this would lock up the JavaFX 
> thread completely (I tried it). 
> I assume this is why the original calculation was used where it backs of the 
> rate the weak listener trimming code was called as the array list grew.

I honestly don't quite understand the old cleanup behavior of `(oldCapacity * 
3)/2 + 1`. Why is it grown by x1.5? In your tests, can you try to change the 
cleanup threshold to higher and lower values and see what differences you get?

At the very least, the initial values of the counters should be set according 
to the specific constructor used.

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

PR: https://git.openjdk.java.net/jfx/pull/108

Reply via email to