ScrollView + DirectoryTree (TreeControl) slow on a large number of elements
I detected this behavior while implementing a Widget based on TreeControl but it's also reproducible with DirectoryTree.
When asked to display a large number of elements, the view gets very slow (up to several seconds between I hover/press a key and the view is updated).
An easy way to reproduce is to create a large number of files in some temporal directory (e.g: mkdir /tmp/example; for i in $(seq 1 6000); do touch /tmp/example/file_${i}; done and then opening it with examples/code_viewer.py.
I am willing to help profiling and testing this issue if it affects others.
The tree control is slow with a large number of elements because it uses Rich's tree control and re-renders when you make changes (even hovering).
We're planning an update which uses a new API to do more efficient updates, which will make the tree control scalable.
Thanks @willmcgugan
Did we solve your problem?
Glad we could help!