What makes a JavaFx 1.2 Scene Graph Refresh?

javafx, paint, performance, scalability, scenegraph

Solution

JavaFX script is a powerful UI language but certain practices will kill performance. Best performance generally boils down to:

keeping the Scene Graph small

keeping use of bind to a minimum (you can look at using triggers instead which are more performant)

This blog post by Jim Weaver expands these points.

I'm not sure as to the specific answers to your questions. If you examine the 1.2.1 docs you might be able to find a point in the Node documentation that you can override and add println statements but I'm not sure it can be done. You could try posting on forums.sun.com

Problem

My first question =). I'm writing a video game with a user interface written in JavaFx. The behavior is correct, but I'm having performance problems. I'm trying to figure out how to figure out what is queuing up the refreshes which are slowing down the app. I've got a relatively complex Scene Graph that represents a hexagonal map. It scales so that you could have 100 or a 1000 hexagons in the map. As the number of hexagons grow the responsiveness of the gui decreases. I've used YourKit (a Java Profiler) to trace these delays to major redraw operations. I've spent most of the night trying to figure out how to do two things and understand one thing: 1) Cause a CustomNode to print something to the console whenever it is painted. This would help me identify exactly when these paints are being queued. 2) Identify when a CustomNode is put on the repaint queued. If I answered 1 and 2, I might be able to figure out what it is that is binding all these different nodes together. Is it possible that JavaFX only works through global refreshes (doubtful)?

Original source