-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
jfx11, 8u172, 10
-
x86_64
-
generic
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
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
- duplicates
-
JDK-8193445 JavaFX CSS is applied redundantly leading to significant performance degradation
- Resolved
- relates to
-
JDK-8183100 Styles not applied reliably after Java 8u92
- Resolved