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

Performance problem with TreeTableView selectAll()

XMLWordPrintable

    • x86_64
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Redhat EE 2.6.32-431.11.2.el6.x86_64

      A DESCRIPTION OF THE PROBLEM :
      we have very large TreeTables in our product, and selection of large numbers of elements (25K and up) takes a long time. Running our code in JProfiler and decompiling, we can see an N^2 complexity cost to doing selection in the JavaFX code below.

      It appears that there are two nested loops that iterate over the rows. (N*N cost)

      The first iteration occurs in TreeTableView selectAll(). Inside that loop it gets a TreeTablePosition, which in turn calls treeTableView.getTreeItem(row) in the constructor. the getTreeItem function calls TreeUtil.getItem() inside the function, and that function has another loop that iterates over the children of the parent (which in this case is all the rows of the table, we have a flat list of 25K rows we are doing selectAll on)

      This problem is noticeable at 25K rows and with enough rows will eventually slow down to the point of hanging.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      build a treeTableView and populate it with a large number of rows. then call selectAll on the table.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      performance should be linear with number of rows or near so.
      ACTUAL -
      slow performance with large numbers of rows

      REPRODUCIBILITY :
      This bug can be reproduced often.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: