-
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 #127
8197991: Selecting many items in a TableView is very slow #127
Conversation
Hi yososs, welcome to this OpenJDK project and thanks for contributing! We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user yososs" as summary for the issue. If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing |
/signed |
Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated! |
Hi @ThomasDaheim, thanks for making a comment in an OpenJDK project! All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user ThomasDaheim for the summary. If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use. |
Hi, |
Webrevs
|
/reviewers 2 |
@kevinrushforth |
@aghaisas can you also review this? |
Any progress with having this merged? |
This is a very good attempt to improve selection performance. I have few review comments. |
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
} | ||
|
||
// is right most bit | ||
if( index == bitset.length()-1 ){ |
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.
Spacing correction needed.
Correct spacing is : "if (index == bitset.length()-1) {"
Please correct at other places in this PR.
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Outdated
Show resolved
Hide resolved
Automated performance testing should be distinguished from regular testing tasks, as it extends the build time. Or, if you want to maintain this test in a repository, you need to tell me the directory where it is stored. The reviewer didn't point out that the |
870e984
to
791c03c
Compare
791c03c
to
59b6d0b
Compare
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 commented.
modules/javafx.controls/src/main/java/javafx/scene/control/MultipleSelectionModelBase.java
Show resolved
Hide resolved
I've run SelectListView and SelectTableView tests and both run fine. As for the SelectTableView test, with 700_000 rows, when there is no selection, pressing SelectToEnd takes around 3.1 seconds, as expected. However, if there is one single row selected, after pressing SelectToEnd, the selection doesn't complete, and I have to abort and quit the app. Instead of:
this:
seems to work and times are again around 3 seconds or less. Maybe you can check why that is happening? And about the test discussion above, I understand that running the included tests as part of the automated test wouldn't make much sense (as these can take too long). However, maybe these could be added as unit tests with a reduced number of item/rows. Instead of measuring performance (selection times would depend on each machine), I'd say you could simply verify that selection works as expected. While most of the changes are just about caching |
As an overview, the new implementation can handle selectRange up to 50_000 records. This assumes general manual operation. However, after clearing the selection (a rare operation in manual operation), it is as efficient as selectAll. However, this is a two-time change. The response difference is caused by the next conditional branch (size == 0) of SortedList. This will be the next hotspot to improve as seen by this improvement. I can't include it in this PR because I don't have time to work. I haven't tried it, but changing the call to insertToMapping for each record of this method to setAllToMapping for each range seems to be as efficient as selectAll. javafx.collections.transformation.SortedList.java private void addRemove(Change<? extends E> c) {
if (c.getFrom() == 0 && c.getRemovedSize() == size) {
removeAllFromMapping();
} else {
for (int i = 0, sz = c.getRemovedSize(); i < sz; ++i) {
removeFromMapping(c.getFrom(), c.getRemoved().get(i));
}
}
if (size == 0) {
setAllToMapping(c.getList(), c.getTo()); // This is basically equivalent to getAddedSubList
// as size is 0, only valid "from" is also 0
} else {
for (int i = c.getFrom(), to = c.getTo(); i < to; ++i) {
insertToMapping(c.getList().get(i), i);
}
}
} |
@yososs Unknown command |
The work in this PR has been picked up by @abhinayagarwal in PR #673 so I am closing this one. |
https://bugs.openjdk.java.net/browse/JDK-8197991
The performance of the selectAll and selectRange methods of the MultiSelectionModel class has been greatly improved.
This greatly improves the response when selecting multiple items in ListView and TableView.
However, in TreeView / TreeTableView, the improvement effect is hidden mainly due to the design problem of the cache of TreeUtil.getTreeItem ().
Reference value of the number of data that can be handled within 3 seconds of processing time (before-> after)
ListView
TableView
You can see performance improvements in the following applications:
Progress
Issue
Download
$ git fetch https://git.openjdk.java.net/jfx pull/127/head:pull/127
$ git checkout pull/127