On Wed, 8 Jan 2025 22:19:20 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> Perhaps it is not as dire, but it may be worth a short check how this works 
>> with say 1000 nodes with and without this new code (no need to register 
>> listeners, I agree that that is a different problem, I was more worried 
>> about how CSS handles this many changes).  Perhaps also a case where there 
>> is also some style change going on linked to the odd or even pseudo class 
>> (although if that is much slower, then I guess that's what the user 
>> wanted...)
>
> A thousand of nodes scenario is possible and I think it needs to be tested, 
> just to estimate the impact.  For example, a rich text type of control: 
> TextFlow with a thousand small Text instances all styled differently (or tied 
> to odd/even pseudo class).
> 
> Although I am struggling to see the use case for such an arrangement.

It's worth pointing out that the usual case of back-insertion doesn't incur any 
unexpected overhead, as all nodes that come before the inserted node are 
unaffected by the change:

var container = new StackPane();
for (int i = 0; i < 1000; ++i) {
    container.getChildren().add(new Button());
}


It's only the unusual case of front-insertion that incurs some overhead by 
flipping the odd/even class for all subsequent nodes:

var container = new StackPane();
for (int i = 0; i < 1000; ++i) {
    container.getChildren().add(0, new Button());
}

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1652#discussion_r1907934195

Reply via email to