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

Slow performance of setScene(javafx.scene.Scene) because of computeMinHeight(..)

XMLWordPrintable

    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Hardware specification:

      Dell Latitude 5501
      Intel(R) UHD Graphics 630
      NVIDIA GeForce MX150
      ------
      Software specification:

      Microsoft Windows Pro 10

      openjdk version "21.0.1" 2023-10-17 LTS
      OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sha
      ring)

      JavaFX 21.0.1

      -------

      VisualVM 2.1.7

      A DESCRIPTION OF THE PROBLEM :
      Hello,

      After the upgrade to JavaFX 21.0.1 the performance of Scenes containing a TableView with 53 columns dropped significantly.
      Further analysis in VisualVM showed, that there seem to be a lot of invocation to the reapplyCss() method, that lead to this performance drop.

      I noticed similar issues with regards to the procession of CSS: https://bugs.openjdk.org/browse/JDK-8151756?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&showAll=true that have been fixed in the past.

      The application uses css files that are embedded with the <stylesheets>-Tag in the FXML file as well as the standard moderna design.

      A downgrade to JavaFX 17 solves the issue as the UI renders immediately.
      ---------------------------------------------

      Stacktrace:
      javafx.stage.Stage.setScene (javafx.scene.Scene) 37.454 ms (98 %) 37.137 ms (99,8 %) 1
      javafx.stage.Window.setScene (javafx.scene.Scene) 37.454 ms (98 %) 37.137 ms (99,8 %) 1
      javafx.beans.property.ObjectPropertyBase.set (Object) 37.454 ms (98 %) 37.137 ms (99,8 %) 1
      javafx.beans.property.ObjectPropertyBase.markInvalid () 37.454 ms (98 %) 37.137 ms (99,8 %) 1
      javafx.stage.Window$SceneModel.invalidated () 37.454 ms (98 %) 37.137 ms (99,8 %) 1
      javafx.stage.Window$SceneModel.updatePeerScene (com.sun.javafx.tk.TKScene) 37.450 ms (98 %) 37.137 ms (99,8 %) 2
      javafx.scene.layout.Region.minHeight (double) 34.376 ms (89,9 %) 34.102 ms (91,6 %) 462
      javafx.scene.Parent.minHeight (double) 34.376 ms (89,9 %) 34.104 ms (91,6 %) 422
      javafx.scene.layout.BorderPane.computeMinHeight (double) 34.376 ms (89,9 %) 34.105 ms (91,6 %) 1
      javafx.scene.layout.BorderPane.getAreaHeight (javafx.scene.Node, double, boolean) 34.376 ms (89,9 %) 34.105 ms (91,6 %) 5
      javafx.scene.layout.Region.computeChildMinAreaHeight (javafx.scene.Node, double, javafx.geometry.Insets, double) 34.373 ms (89,9 %) 34.095 ms (91,6 %) 1
      javafx.scene.layout.Region.minHeight (double) 34.373 ms (89,9 %) 34.095 ms (91,6 %) 1
      javafx.scene.Parent.minHeight (double) 34.373 ms (89,9 %) 34.095 ms (91,6 %) 1
      javafx.scene.layout.AnchorPane.computeMinHeight (double) 34.373 ms (89,9 %) 34.095 ms (91,6 %) 1
      javafx.scene.layout.AnchorPane.computeHeight (boolean, double) 34.373 ms (89,9 %) 34.095 ms (91,6 %) 1
      javafx.scene.layout.Region.minHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.Parent.minHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.control.Control.computeMinHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.control.SkinBase.computeMinHeight (double, double, double, double, double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.layout.Region.minHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 2
      javafx.scene.Parent.minHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 2
      javafx.scene.control.skin.TableHeaderRow.computeMinHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.control.skin.TableHeaderRow.computePrefHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.layout.Region.prefHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.Parent.prefHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.control.skin.NestedTableColumnHeader.computePrefHeight (double) 34.373 ms (89,9 %) 34.096 ms (91,6 %) 1
      javafx.scene.control.skin.NestedTableColumnHeader.checkState () 34.369 ms (89,9 %) 34.082 ms (91,6 %) 1
      javafx.scene.control.skin.NestedTableColumnHeader.updateTableColumnHeaders () 34.369 ms (89,9 %) 34.082 ms (91,6 %) 1
      javafx.scene.control.skin.NestedTableColumnHeader.updateContent () 34.274 ms (89,7 %) 34.000 ms (91,3 %) 1
      javafx.collections.ModifiableObservableListBase.setAll (java.util.Collection) 34.269 ms (89,7 %) 33.996 ms (91,3 %) 1
      javafx.collections.ObservableListBase.endChange () 34.269 ms (89,7 %) 33.998 ms (91,3 %) 2
      javafx.collections.ListChangeBuilder.endChange () 34.269 ms (89,7 %) 33.998 ms (91,3 %) 2
      javafx.collections.ListChangeBuilder.commit () 34.269 ms (89,7 %) 33.998 ms (91,3 %) 2
      javafx.collections.ObservableListBase.fireChange (javafx.collections.ListChangeListener.Change) 34.269 ms (89,7 %) 33.998 ms (91,3 %) 1
      javafx.scene.Node.setScenes (javafx.scene.Scene, javafx.scene.SubScene) 34.265 ms (89,6 %) 33.996 ms (91,3 %) 106
      javafx.scene.Node.invalidatedScenes (javafx.scene.Scene, javafx.scene.SubScene) 34.265 ms (89,6 %) 33.997 ms (91,3 %) 106
      javafx.scene.Node$ReadOnlyObjectWrapperManualFire.fireSuperValueChangedEvent () 34.252 ms (89,6 %) 33.946 ms (91,2 %) 106
      javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent () 34.252 ms (89,6 %) 33.946 ms (91,2 %) 106
      javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent () 34.252 ms (89,6 %) 33.946 ms (91,2 %) 106
      javafx.scene.Node.applyCss () 18.205 ms (47,6 %) 18.036 ms (48,5 %) 757
      javafx.scene.Node.processCSS () 18.200 ms (47,6 %) 18.029 ms (48,4 %) 757
      javafx.scene.Node.reapplyCss () 6.663 ms (17,4 %) 6.806 ms (18,3 %) 3.189

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a JavaFX 21 application and add a TableView with 50+ columns and a few hundred rows and monitor the application in the profiler and watch out for the stacktrace .

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Rendering is smooth and fast
      ACTUAL -
      Several invocations of reapplyCss()

      CUSTOMER SUBMITTED WORKAROUND :
      Downgrade to JavaFX17

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: