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

Performance regression probably caused by correction of JDK-8183100

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Microsoft Windows [version 10.0.16299.371]

      A DESCRIPTION OF THE PROBLEM :
      Jdk8.172 introduce a big performance regression with many levels of nested javafx Nodes with styleClass

      REGRESSION : Last worked in version 8u162

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Run the attached example (same example that I attached for https://bugs.openjdk.java.net/browse/JDK-8199216).
      - Type "300" in text Field
      - click on "click" button


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      in Jdk1.8.162, with same scenario, view is dispayed INSTANTANEOUSLY!!!!
      ACTUAL -
      in JDK1.8.172, view takes at least 3 second to be displayed

      In our application, time to build views is severely degraded, sometimes by a factor if 20!!!

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

      import javafx.application.Application;
      import javafx.beans.value.ObservableValue;
      import javafx.geometry.Insets;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      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 {
              String dialogStyleSheet = getClass().getResource("perfo.css").toExternalForm();
              pane = new BorderPane();
              final Button button = new Button("click");
              TextField textField = new TextField("10");
              pane.setTop(new ToolBar(button, textField));
              button.setOnAction(e -> {
                  HBox hbox = new HBox();
                  hbox.getStyleClass().add("myhbox");
                  int nb = Integer.parseInt(textField.getText());
                  for (int i = 0; i < nb; i++) {

                      hbox = new HBox(new Text("y"), hbox);
                      hbox.getStyleClass().add("myhbox");
                      final HBox h = hbox;
                      h.setPadding(new Insets(1));
                      hbox.hoverProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean isHover) -> {
                          if (isHover) {
                              h.getStyleClass().add("myhbox-hover");
                          } else {
                              h.getStyleClass().remove("myhbox-hover");
                          }

      // h.setStyle(isHover ? "-fx-border-color: red; -fx-border-width: 1;" : "");
      // if (isHover) {
      // h.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
      // } else {
      // h.setBorder(null);
      // }
                      });
                  }
                  pane.setCenter(hbox);

              });

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

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

      --------------------
      perfo.css
      /*
      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.
      */
      /*
          Created on : 6 févr. 2018, 15:04:17
          Author : daniel
      */

      .myhbox-hover {
          -fx-border-color: red;
          -fx-border-width: 1;
          -fx-padding : 1 ;
      }

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

      FREQUENCY : always


        Attachments

        1. perfo.css
          0.4 kB
        2. Perfo.java
          2 kB

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: