[mainloop-] during replay, redraw less often #2369
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When replaying commands, visidata 3.0 versions are noticeably slower to load some large sheets than v2.11 was. It's caused by redrawing the screen too often. The symptom to look for is that the progress (
% loading…
) is updated dozens of times per second.Sometimes the quick updates are steady. For other files they come and go in short bursts, then doing proper slower updating for longer stretches. Only the short bursts of quick updates will cause slower loading.
Here is a case that, on my system, consistently exhibits the problem.
After applying 02432ff:
quit.vdj.txt
In this case the bug causes 30% slower loading. It causes the screen to be drawn 37 times per second, vs the fixed version that draws 7 times per second.
While I was patching mainloop, I also fixed an off-by-one error in counting idle timeouts (51421d9). The effect will be ~9% fewer recalculations of columns when idling. To demonstrate the change:
echo a |vd
then make an ExprColumn:=vd.status('test')
. For each row in the column, the ExprColumn will be calculated once, and then recalculated once after every timeout. Before the fix, in v3.0.2 it will output 12 lines to the status bar, and after the fix, only 11.--
Edited to add: it turns out this PR also closes #2274. In that bug,
editCell
queues commands in_nextCommands
, triggering the same high rate of redrawing.