On Mon, 13 Jul 2026 20:30:07 GMT, Marius Hanl <[email protected]> wrote:

> Since the last [PR](https://github.com/openjdk/jfx/pull/2201) made the parent 
> `styleHelper` creation more eager, creating and adding many nodes will be 
> slower (initially).
> 
> The fix is actually something I already had in mind when I did the previous 
> PR: Find the ancestor lazily.
> Now, when we create a `CssStyleHelper` we will not yet set the 
> `firstStyleableAncestor`. 
> This will improve the performance to the level before while all tests still 
> pass.
> 
> This makes sense because `CssStyleHelper` is created (top-down) but not 
> immediately used. It can also be (re)created when a `Node` changes its 
> `Parent` (or deferred from there).
> 
> Later, `transitionToState` is called (top-down) which will then need the 
> `firstStyleableAncestor` (and this is also where we will compute it now). 
> Since in the meantime the scene structure could change, it makes sense to do 
> that as late as possible.
> 
> The days before I also investigated 
> [JDK-8187955](https://bugs.openjdk.org/browse/JDK-8187955) and found a good 
> improvement as well (no recursion needed, we can again use the preexisting 
> loop). Since we now create the `firstStyleableAncestor` lazy, it makes sense 
> to combine it, as otherwise the `isUserSetFont` need to be changed which I 
> think is more risky.
> 
> Also did some digging about `isUserSetFont`, and was added/changed in this 
> tickets:
> - `isUserSetFont` code added: https://bugs.openjdk.org/browse/JDK-8123731
> - `isUserSetFont` code changed: https://bugs.openjdk.org/browse/JDK-8093577
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

I want to explore a couple of scenarios - this might take some time.

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

PR Review: https://git.openjdk.org/jfx/pull/2210#pullrequestreview-4689233456

Reply via email to