RFR: 8290040: Provide simplified deterministic way to manage listeners [v6]

Andy Goryachev angorya at openjdk.org
Tue Oct 18 16:08:50 UTC 2022


On Tue, 18 Oct 2022 12:54:22 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Thanks, I understand, what I find odd is that this would be the first property in `Node` to be stored this way.  If this was so important, then why isn't this done for other properties? There seem to be sufficient candidates for this approach to "slim" down `Node` (infrequently used properties like `Subscene`, `id`, `style`, `blendMode`).
>> 
>> There's even a `MiscProperties` objects which is described as "Misc Seldom Used Properties" that is created only when needed with these properties:
>> 
>>         private LazyBoundsProperty boundsInParent;
>>         private LazyBoundsProperty boundsInLocal;
>>         private BooleanProperty cache;
>>         private ObjectProperty<CacheHint> cacheHint;
>>         private ObjectProperty<Node> clip;
>>         private ObjectProperty<Cursor> cursor;
>>         private ObjectProperty<DepthTest> depthTest;
>>         private BooleanProperty disable;
>>         private ObjectProperty<Effect> effect;
>>         private ObjectProperty<InputMethodRequests> inputMethodRequests;
>>         private BooleanProperty mouseTransparent;
>>         private DoubleProperty viewOrder;
>> 
>> Let's see what others think before I change this. It does sound like a reasonable approach though.
>
> I don't have time to review this as I am busy with JavaOne, so this is just a quick note to say that if there is sufficient benefit to add a `shown` property to the core of JavaFX, then it should be added _as_ a property -- possibly in MiscProperties if we think it is a seldom-used property. I don't like the idea of using `getProperties` for this.

I'd respectfully disagree: in a large application, there might be hundreds (a thousand?) Nodes, and only a handful (10-20?) Nodes with this property (2%), so it's a waste of RAM.  One may think it's only 8Kb on a 64 bit machine, but it does add up quickly.  Even the access pattern is basically 'get it once to establish the fluent pipeline', with no more calls to the Node accessor (unlike MiscProperties constituents, some of which get accessed rather frequently).

-------------

PR: https://git.openjdk.org/jfx/pull/830


More information about the openjfx-dev mailing list