On Thu, 18 Dec 2025 00:11:32 GMT, Cormac Redmond <[email protected]> wrote:
>> The problem with the current change is we are wasting time/CPU always, >> instead of doing only what's strictly needed. Just imagine if the `sorted` >> array is fairly large and contains only a few items - then you are >> overwriting many `null` entries with `nulls` needlessly. >> >> Besides, we have the exact number of entries to null out >> (`c.getRemovedSize()`), which makes the life easier. > > I must be missing something. I don't see how that situation can occur, if > sorted is large but only contains a few items, then the source list must have > been large at one point, and shrunk, at which point the excess would be > nulled, once. > > There's a break there to stop subsequent calls from needlessly nulling > anything out on subsequent changes. > > On the other hand, putting inside the if statement means we're needlessly > removing elements if they're just about to be overwritten from other changes > in the same change set. Anyway, that's moved inside now, and simplified a bit (there's no need for the null check + break any more). ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2000#discussion_r2629045895
