On Wed, 17 Nov 2021 05:34:46 GMT, Abhinay Agarwal <d...@openjdk.java.net> 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 119: > 117: Object obj = get(i); > 118: if (o.equals(obj)) return i; > 119: } An alternative is return IntStream.range(0, size()) .filter(i -> o.equals(get(i))) .findFirst() .orElse(-1); I don't know if it helps. 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();`? ------------- PR: https://git.openjdk.java.net/jfx/pull/673