On Tue, 7 Apr 2026 14:46:05 GMT, Andy Goryachev <[email protected]> wrote:

> > `TreeTableView` has other problems, namely that every `getItem` call starts 
> > a DFS from root. While the sort is fixed for `TreeTableView`, calling 
> > `selectAll` to test it would take days for 100k+ items.
> 
> Not days, but a few seconds on my macOS 26.3.1 M1, which is acceptable. What 
> is DFS?
> 
> edit: ~30 seconds

[getItem(](https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/java/javafx/scene/control/TreeUtil.java#L56)

Unless the item is cached, each call to `getItem` starts a depth-first-search 
(DFS) at the root of the tree and works its way down until the item is found. 
`getItem` is required to add an item to the selected indices list, among other 
things.

https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/java/javafx/scene/control/TreeUtil.java#L56

This is really unfortunate for sequential access (e.g. selectAll) which could 
easily resume the DFS at the previous node. Its another classic O(N^2) issue. 
This appears to fix the issue: 

https://github.com/openjdk/jfx/compare/master...chuckyschluz:jfx:8181411-treetableview

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

PR Comment: https://git.openjdk.org/jfx/pull/2131#issuecomment-4200314728

Reply via email to