On Fri, 9 Oct 2020 17:47:31 GMT, yosbits 
<github.com+7517141+yos...@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

Reply via email to