JavaFX Missing Features Survey: Performance & Quality

I take it as a good sign that the categories “Performance” and “Quality” have not seen a lot of submissions in the “Missing Features Survey”.

Performance

In the survey the performance of JavaFX was compared with the performance of Swing and people noticed that JavaFX is slower than Swing. I personally have yet to find a use-case where that is true but I do believe that they can be found, however it should be noted that JavaFX also provides a much better coding experience based on a modern API and architecture. JavaFX supports property bindings and CSS styling. These things of course do take their toll on CPU time. Swing was designed for computer hardware that existed 20 years ago. JavaFX is targeting today’s hardware.

Something that I can agree on is that the use of huge quantities of more or less complex controls within a single stage does lead to performance issues. In a test case that was discussed by several JavaFX experts in Germany, Switzerland, and Austria we looked at the performance of JavaFX when displaying several thousand textfields. This does sound silly but there are use-cases out there that need to create this amount of controls. When comparing the time it took JavaFX to display the textfields to the time it took HTML to do the same we could clearly see that HTML can do it almost instantly while JavaFX needed several seconds. The culprit seems to be the code that performs the CSS styling. Somebody should take a closer look at it. This doesn’t have to be an Oracle employee. The code is open source and available to anybody!

Quality

The following items were mentioned related to quality:

  • WebView needs to be kept up-to-date with the current versions of WebKit
  • Image resizing needs to be improved to ensure that lines do not vanish when decreasing image sizes.
  • Better font rendering (all fonts on all devices).
  • Canvas rendering quality needs to be on par with scene graph rendering.

This is it for the topic “performance and quality”. Next blog will be about CSS and FXML.

Happy coding everyone!

5 Comments

  1. Have you run profiling on a JavaFX app? Admittedly, I haven’t run profiling on JavaFX since Java 8u20. But at the time, CSS counted for less overhead than layout – except at startup. I’m sure there is room for improvement.

    It is interesting that you call out TextField. TextField has its own textProperty and this makes calculating the font size (for converting font relative units like em’s) more complicated. There are tricks that you can try, like setting the font size on the textfield or adding a .text-field { -fx-font-size: 12; } rule to your stylesheet. These would stop the CSSStyleHelper from looking for a font style.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s