Skip to content
This repository was archived by the owner on Jun 24, 2021. It is now read-only.
This repository was archived by the owner on Jun 24, 2021. It is now read-only.

JDK-8197991: Selecting many items in a TableView is very slow  #481

@koeberlue

Description

@koeberlue

I created a TableView, set the selection model to SelectionMode.MULTIPLE and added lots of items to it (~8000). When I hit ctrl + a to select all elements in the table, the application freezes for approximately 6 seconds. This gets significantly worse when I add more items. With 20000 items I have to wait for more than a minute.

Here is a small sample application to reproduce the behavior:

public class SlowTableApplication extends Application {

    @Override
    public void start(Stage stage) {
        var table = new TableView<>();
        table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        table.getColumns().add(new TableColumn<>());
        IntStream.range(0, 20_000).forEach(i -> table.getItems().add(new Object()));
        stage.setScene(new Scene(table));
        stage.show();
    }
}

Do I need to implement my own SelectionModel to make this work? Since TableView uses VirtualFlow, I assumed that there would not be a great performance hit when selecting a large amount of items.


I am using Version 12.0.1 of javafx-controls and the javafx-maven-plugin to run the application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions