Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FXML performance issue with static setters, BeanAdapter methods are slow

a_pabstJun 3 2014 — edited Jun 27 2014

We noticed that if one uses static setters in FXML, e.g. AnchorPane.bottomAnchor="0.0", there is a substantial performance impact on FXML parsing.

More than 90% of the execution time is spent in these two methods:

com.sun.javafx.fxml.BeanAdapter.getStaticSetterMethod(Class, String, Class, Class)

com.sun.javafx.fxml.BeanAdapter.getStaticGetterMethod(Class, String, Class)

a) Parsing an FXML with 100 stack panes in an AnchorPane with static setters takes ~100ms on average on my machine

b) Parsing an FXML with 100 stack panes in an AnchorPane without static setters takes ~8ms on average on my machine

c) Creating the same scene tree as in a) programmatically takes ~2ms on average on my machine

This is the FXML:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.*?>

<AnchorPane>

    <children>

        <StackPane  AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />

        <StackPane  AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />

          ...

        <StackPane  AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />

    </children>

</AnchorPane>

Is that a bug or is it expected behaviour?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 25 2014
Added on Jun 3 2014
2 comments
2,630 views