JDK-8209830 : Quadratic performance regression when creation of nested JAVAFX nodes
  • Type: Bug
  • Component: javafx
  • Sub-Component: scenegraph
  • Affected Version: 8u172,9,10,openjfx11
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: x86_64
  • Submitted: 2018-08-21
  • Updated: 2019-10-18
  • Resolved: 2019-10-18
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows [version 10.0.17134.228]

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)


A DESCRIPTION OF THE PROBLEM :
Since Java 8u172, severe degradation of performance for creation of nested JAVAFX nodes, even when no style sheet is used.

This bug is really BLOCKING for our product!
There is NO WAY for us to upgrade to recent java version (Java 8u181 or Java 10)

REGRESSION : Last worked in version 8u162

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the attached example with a java profiler.
Type "300" in text field and measure performance.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Jdk 8u162 : 55 ms
ACTUAL -
Jdk 8u181 or jdk10.0.2: 1400 ms!!

---------- BEGIN SOURCE ----------
package perfo;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.control.ToolBar;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author daniel
 */
public class Perfo extends Application {

    private BorderPane pane;

    @Override
    public void start(Stage primaryStage) throws Exception {
        pane = new BorderPane();
        TextField textField = new TextField("300");
        pane.setTop(new ToolBar(textField));
        textField.setOnAction(e -> {
            HBox hbox = new HBox();
            int nb = Integer.parseInt(textField.getText());
            for (int i = 0; i < nb; i++) {

                hbox = new HBox(new Text("y"), hbox);
                final HBox h = hbox;
                h.setPadding(new Insets(1));
            }
            pane.setCenter(hbox);

        });

        Scene scene = new Scene(pane);
        primaryStage.setScene(scene);
        primaryStage.sizeToScene();
        primaryStage.show();
    }

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

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

CUSTOMER SUBMITTED WORKAROUND :
NO BYPASS

FREQUENCY : always



Comments
This is likely a duplicate of JDK-8193445, which was caused by the fix for JDK-8183100. That latter fix reverted a buggy performance improvement fix that caused several functional regressions, so we cannot restore the performance directly. Instead we will need to come up with another solution.
23-08-2018

Issue is reproducible and its a regression in JDK 8u172. Windows 10, 64-bit JDK results ----------------- 8u171-b11 : Pass (execution time ~35 ms) 8u172-b01 : Fail <== Regression latest openjfx : Fail (execution time ~1400ms)
22-08-2018