On Sun, 15 Mar 2026 11:38:42 GMT, chuckyschluz <[email protected]> wrote:

>> Fixes [JDK-8311505](https://bugs.openjdk.org/browse/JDK-8311505)
>> 
>> This PR uses `set(int index, int end, boolean isSet)` in 
>> `javafx.scene.control.MultipleSelectionModelBase` to avoid excessive calls 
>> to `indexOf` when deselecting continuous ranges of rows. 
>> 
>> Benchmarks produced with the test application provided here: 
>> https://bugs.openjdk.org/browse/JDK-8311505
>> 
>> Before (mainline):
>> 
>> 
>> Select item count 500000 took 724
>> Deselect item count 500000 took 73103
>> 
>> 
>> After (this PR):
>> 
>> 
>> Select item count 500000 took 249
>> Deselect item count 500000 took 88
>> 
>> 
>> Passes all unit tests:
>> 
>> `.\gradlew.bat :controls:test`
>> `.\gradlew.bat :systemTests:test`
>> 
>> Thank you!
>
> chuckyschluz has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   minor cleanup

FYI - I've created https://bugs.openjdk.org/browse/JDK-8380308 for a similar 
behavior in the `TreeView`.

modules/javafx.controls/src/main/java/javafx/scene/control/ControlUtils.java 
line 197:

> 195:                     .sorted()
> 196:                     .boxed()
> 197:                     .toList();

I wonder if using a `BitSet` would be faster because it's
- compact
- deduplication is nearly free
- sorting is free

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

PR Comment: https://git.openjdk.org/jfx/pull/2100#issuecomment-4076780554
PR Review Comment: https://git.openjdk.org/jfx/pull/2100#discussion_r2948480813

Reply via email to