Can JavaFX do CAD?

Pavel Safrata pavel.safrata at
Thu Jul 25 04:44:50 PDT 2013

Hi Richard,
I have a comment to one of your questions:

On 24.7.2013 21:06, Richard Bair wrote:
> 	- Would we benefit from a "full lazy" model for properties where we only instantiate them if somebody adds a listener

We've done that in javafx.scene.transform.Affine. This is a class 
representing a general Affine transformation matrix, so it has twelve 
double properties. I'm probably not able to find the actual numbers we 
measured back then, but here is what I can remember. We used the 3D 
music chart JavaOne demo which operated with the matrices incredibly 
heavily. In this case the properties made a big difference in 
performance; with all the properties instantiated, even 
DoubleProperty.get() shone brightly in profiler results. So we 
introduced the "full lazy" properties which helped. Then we looked into 
it a bit more but were not able to create similar condition with any 
other use-case; the property getter is just a null check and a couple of 
calls in addition. It seemed that the transform matrices were a special 
case where some 3D algorithms call the matrix element getters too much, 
so we've left it at that.

Regarding memory requirements of the "full lazy" properties, let me 
state the obvious:
- if the property is not used at all, we have a reference and a double 
instead of just a reference (worse unless in bucket)
- if getters/setters are called, we still have a reference and a double 
instead of full instantiated property (better)
- if a listener is added, we have instantiated property and a double 
instead of just the property (slightly worse)
So it looks like it would make best sense to introduce this for 
properties that are often get/set but usually don't have listeners on 
them. I'm not sure if such set exists and can be identified.

It's still a good idea to investigate, I just thought this was worth 


More information about the openjfx-dev mailing list