RFR: 8197991: Selecting many items in a TableView is very slow

Abhinay Agarwal duke at openjdk.java.net
Mon Nov 22 15:58:21 UTC 2021


On Thu, 18 Nov 2021 00:54:30 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> This work improves the performance of `MultipleSelectionModel`  over large data sets by caching some values and avoiding unnecessary calls to `SelectedIndicesList#size`. It further improves the performance by reducing the number of iterations required to find the index of an element in the BitSet.
>> 
>> The work is based on [an abandoned patch](https://github.com/openjdk/jfx/pull/127) submitted by @yososs
>> 
>> There are currently 2 manual tests for this fix.
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/ReadOnlyUnbackedObservableList.java line 193:
> 
>> 191:             arr[i] = get(i);
>> 192:         }
>> 193:         return arr;
> 
> Have you tried `return stream().toArray();`?

I haven't measured how `stream().toArray()` compare to a for..loop, but I inherently try to avoid streams in such scenarios.

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

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


More information about the openjfx-dev mailing list