Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8197991

Selecting many items in a TableView is very slow

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b117
    • Introduced In Version:
      9
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "9.0.4"
      Java(TM) SE Runtime Environment (build 9.0.4+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      Create a TableView with 50000 items and call selectAll.
      The call does not finish on my system.


      REGRESSION. Last worked in version 8u161

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_161"
      Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the sample code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Output:
      "item count 50000 took XXms"

      where XX < 100ms


      ACTUAL -
      Code does not finish for 50000 items.
      It is very slow for 10000 items.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import static javafx.scene.control.SelectionMode.MULTIPLE;

      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.beans.property.SimpleObjectProperty;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;


      public class Main2 extends Application {

      final ObservableList<SimpleObjectProperty<Integer>> listitems = FXCollections.observableArrayList();
      private static int ITEM_COUNT = 50000;

      public Main2() {
      for (int i = 0; i < ITEM_COUNT; ++i) {
      listitems.add(new SimpleObjectProperty<>(i));
      }
      }

      @Override
      public void start(Stage primaryStage) {
      final TableView<SimpleObjectProperty<Integer>> lv = new TableView<>();
      final TableColumn<SimpleObjectProperty<Integer>, Integer> c = new TableColumn<>();
      c.setCellValueFactory(TableColumn.CellDataFeatures::getValue);
      lv.getColumns().add(c);
      lv.setItems(listitems);

      final HBox hbox = new HBox();
      hbox.getChildren().add(lv);
      primaryStage.setScene(new Scene(hbox));

      lv.getSelectionModel().setSelectionMode(MULTIPLE);

      primaryStage.show();
      Platform.runLater(() -> {
      long startMillis = System.currentTimeMillis();
      lv.getSelectionModel().selectAll();
      System.out.println("item count " + ITEM_COUNT + " took " + (System.currentTimeMillis() - startMillis));
      System.exit(1);
      });
      }

      public static void main(String[] args) {
      Application.launch(args);
      }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: