RFR: 8253086: Optimization of removeAll and retainAll of ObservableListWrapper [v4]

Kevin Rushforth kcr at openjdk.java.net
Fri Oct 9 23:02:08 UTC 2020


On Fri, 9 Oct 2020 17:47:31 GMT, yosbits <github.com+7517141+yososs at openjdk.org> wrote:

> * new BitSet(c.size())
> 
> Don't you notice this mistake?

It certainly isn't an exact size, and probably not a very good guess in many cases (e.g., a small number of objects
where one near the end is chosen), but it is at least a lower limit on the memory you need.

So I take it you propose to allocate the BitSet the first time you need it, while looping in the reverse order of this
array list? That will work, at the (fairly minor) expense of having to do a null check in the loop (or the added
complexity of an initial loop that runs until you find one and a second loop from that point to the end).

I'm still not convinced that this is worth the effort, at least not without a test case showing some gain that we can
measure.

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

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


More information about the openjfx-dev mailing list