textual icon indicating copy to clipboard operation
textual copied to clipboard

ScrollView + DirectoryTree (TreeControl) slow on a large number of elements

Open amorenoz opened this issue 3 years ago • 2 comments

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.

amorenoz avatar Sep 14 '22 07:09 amorenoz

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.

willmcgugan avatar Sep 14 '22 11:09 willmcgugan

Thanks @willmcgugan

amorenoz avatar Sep 14 '22 11:09 amorenoz

Did we solve your problem?

Glad we could help!

github-actions[bot] avatar Oct 25 '22 09:10 github-actions[bot]