Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to split JavaFX GUI into fxml files with good performance?

Tags:

java

javafx

fxml

I am working on an enterprise-scale project on which JavaFX 8 was choosen as the frontend technology. Target platform is a windows-based tablet, so performance is even more likely to be an issue on this.

The application is made up of dozens of screens (essentially forms) and it was decided to split-up the GUI description into a myriad of FXML files, in a kind of component-based approach (some sub-panes inside a screen will be defined in their own fxml for instance). Also Spring is used to plug the controllers and services inside said components.

The main problem is that now, 200+ fxml are loaded at startup (for a client application) and it takes around 20 seconds to do so... which is a bit too noticeable :(

I've already ruled out Spring overhead as the culprit (we have a Spring-aware FXMLLoader implementation but most of the time is spent inside the load method).

I wonder if this is the right approach... Is there an "scalability" issue in loading too many FXML files? A recommended limit on the number of fxml to attempt to load / granularity of fxml in a JavaFX app?

Any tips or similar-situation feedback for this performance problem are welcome! Thank you.

like image 357
Simon Baslé Avatar asked Nov 02 '22 01:11

Simon Baslé


1 Answers

Try to only load the parts you actually want to show to the user at start-up.

Also please report performance issues you find here: https://javafx-jira.kenai.com/secure/Dashboard.jspa

Also note the feature request to compile FXML files to .class files (not yet implmented): https://javafx-jira.kenai.com/browse/RT-23527

like image 113
Puce Avatar answered Nov 14 '22 17:11

Puce