[External] : Re: Experiment: Node properties

Andy Goryachev andy.goryachev at oracle.com
Thu Feb 12 19:28:59 UTC 2026


LazyConstants do not fit this use case exactly, I think, especially if we consider skipping initialization in the setter if the default value is used.

-andy



From: Nir Lisker <nlisker at gmail.com>
Date: Thursday, February 12, 2026 at 11:17
To: Andy Goryachev <andy.goryachev at oracle.com>
Cc: openjfx-dev <openjfx-dev at openjdk.org>, Marius Hanl <mariushanl at web.de>
Subject: [External] : Re: Experiment: Node properties

There's LazyConstants in the works for cases like these.
 (https://openjdk.org/jeps/526). Has it been looked at for this optimization?

On Thu, Feb 12, 2026, 19:52 Marius Hanl <mariushanl at web.de<mailto:mariushanl at web.de>> wrote:
I also like the idea. I, once had a similar idea but not enough time to do a deep check. In my opinion, we should make as much lazy as possible, as subclasses and developers often just use a small set of properties really.

What I also had a look back then is default values for properties, like focusTraversable. Right now, changing default values (via the setter) in the constructor will initialize the property, even if otherwise we never need it (like pickOnBounds, focusTraversable, ...). Back then, I thought about improving this by using a mechanism which is already there (but not implemented consistently and used everywhere), that is methods like Control.getInitialFocusTraversable(), which could work in a way without initializing this 100 of times (like in case of Cell).

So maybe, we can save a bit more by not initializing properties by (essentially) changing the default value of it (therefore the getter).
Calling the getter in most cases in JavaFX does not yet initialize the property itself.

The biggest benefits will probably be tables, as they have rows (cells) with cells, that can add up quite fast with many columns. Running more optimized on a RaspberryPi is also good thing.

-- Marius
Gesendet: Mittwoch, 4. Februar 2026 um 22:17
Von: "Andy Goryachev" <andy.goryachev at oracle.com<mailto:andy.goryachev at oracle.com>>
An: OpenJFX <openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org>>
Betreff: Experiment: Node properties
I would like to share the results of a little experiment involving optimization of storage of Node properties.  The basic idea is to create a compact fast map-like container to hold the rarely instantiated properties in order to reduce the application memory footprint.

The savings are not overwhelming, but not exactly zero.  I would imagine this optimization might be more interesting in any resource constrained environment such as Android / iOS / RaspberryPi.  Please refer to [0] for the details.

I encourage you to try it with your application, to see whether you notice any change in memory consumption and/or performance.  Let me know what you think!

Cheers,
-andy


References

[0] https://github.com/andy-goryachev-oracle/Test/blob/main/doc/Experiments/NodeProperties.md<https://urldefense.com/v3/__https://github.com/andy-goryachev-oracle/Test/blob/main/doc/Experiments/NodeProperties.md__;!!ACWV5N9M2RV99hQ!LkxecXmsYrYMK2xpdieu9tpnOW9B6pGzfWi57fBffVOZuiCBTmBVqqLvncIYTbtkHJumP-9-v78Vv6p0adPK$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20260212/6a2500f0/attachment-0001.htm>


More information about the openjfx-dev mailing list