Can JavaFX do CAD?

Tom Schindl tom.schindl at bestsolution.at
Thu Jul 25 04:54:27 PDT 2013


On 25.07.13 13:44, Pavel Safrata wrote:
> 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.
> 

If there are really a lot of properties of the same (primitive) type
would it make sense to store their primitive values inside arrays
instead of single fields? Not sure how arrays preform memory and access.
If there are many booleans they could be store inside an short/int/long.

Tom


More information about the openjfx-dev mailing list