-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8197991: Selecting many items in a TableView is very slow #673
Conversation
👋 Welcome back abhinayagarwal! A progress list of the required criteria for merging this PR into |
Webrevs
|
I closed #127 on which this PR is based. @abhinayagarwal Please use the /reviewers 2 |
@kevinrushforth |
...vafx.controls/src/main/java/com/sun/javafx/scene/control/ReadOnlyUnbackedObservableList.java
Show resolved
Hide resolved
...vafx.controls/src/main/java/com/sun/javafx/scene/control/ReadOnlyUnbackedObservableList.java
Show resolved
Hide resolved
Just wondering, isn't it also possible to write some unit tests for the MultipleSelectionModel(Base) ? |
/contributor add @yososs |
@abhinayagarwal Could not parse
|
@Maran23 I don't know what would be an apt unit test as the PR changes implementation detail. If you have suggestions, please let me know. There are 276 unit tests in |
I see that the |
/contributor add Naohiro Yoshimoto yosbits@gmail.com |
@abhinayagarwal |
@kevinrushforth Is there something I can do to move this PR forward? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good to me. I did leave a couple questions about the implementation.
The new manual tests need a copyright header, and I noted a few of the code formatting issues.
...vafx.controls/src/main/java/com/sun/javafx/scene/control/ReadOnlyUnbackedObservableList.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Show resolved
Hide resolved
Thanks for adding the manual test. I can confirm the performance gains. I ran the ListView test, clicked on one of the cells visible without scrolling, then pressed the "select to the end" operation. With the 70k cells defined by the test program that operation ran 13,715 times faster on my machine with this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is very close to being ready to go in. I left one more inline comment about the invalidation of size
. There is also a pending minor code formatting comment.
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good. I left a few comments on the tests.
.../javafx.controls/src/test/java/test/javafx/scene/control/MultipleSelectionModelImplTest.java
Outdated
Show resolved
Hide resolved
.../javafx.controls/src/test/java/test/javafx/scene/control/MultipleSelectionModelImplTest.java
Show resolved
Hide resolved
private void clearSelection(ListView listView) { | ||
long t = System.currentTimeMillis(); | ||
listView.getSelectionModel().clearSelection(); | ||
System.out.println("time:"+ (System.currentTimeMillis() - t)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still pending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes look good.
I tested on Mac. This PR drastically improves the selection time for the provided manual test.
@abhinayagarwal This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 35 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @aghaisas) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@abhinayagarwal |
/sponsor |
Going to push as commit 8c4f966.
Your commit was automatically rebased without conflicts. |
@nlisker @abhinayagarwal Pushed as commit 8c4f966. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This work improves the performance of
MultipleSelectionModel
over large data sets by caching some values and avoiding unnecessary calls toSelectedIndicesList#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 submitted by @yososs
There are currently 2 manual tests for this fix.
Progress
Issue
Reviewers
Contributors
<yosbits@gmail.com>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/673/head:pull/673
$ git checkout pull/673
Update a local copy of the PR:
$ git checkout pull/673
$ git pull https://git.openjdk.java.net/jfx pull/673/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 673
View PR using the GUI difftool:
$ git pr show -t 673
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/673.diff