You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overall, ProgressBar is not a CPU-greedy widget. It does bring a small yet noticeable increase in CPU consumption when left in "indeterminate" mode since this mode involves a sliding animation. As far as I can tell, this is both normal and acceptable.
However, I noticed this CPU consumption does not decrease when the progress bar is hidden (e.g. self.progress_bar.styles.display = 'none'). This could be improved by adjusting Bar.auto_refresh whenever necessary.
Currently, Bar.auto_refresh only reacts to changes of the percentage attribute:
Good point. It probably makes sense for the auto_refresh feature to check if the widget is actually visible before refreshing. Should be a trivial change.
xavierog
changed the title
Displaybar: decrease CPU consumption by adjusting Bar.auto_refresh when styles.display is None
ProgressBar: decrease CPU consumption by adjusting Bar.auto_refresh when styles.display is None
Aug 11, 2024
Overall,
ProgressBar
is not a CPU-greedy widget. It does bring a small yet noticeable increase in CPU consumption when left in "indeterminate" mode since this mode involves a sliding animation. As far as I can tell, this is both normal and acceptable.However, I noticed this CPU consumption does not decrease when the progress bar is hidden (e.g.
self.progress_bar.styles.display = 'none'
). This could be improved by adjustingBar.auto_refresh
whenever necessary.Currently,
Bar.auto_refresh
only reacts to changes of thepercentage
attribute:textual/src/textual/widgets/_progress_bar.py
Lines 90 to 95 in fd36937
The text was updated successfully, but these errors were encountered: