vsh
vsh copied to clipboard
Look into performance of commands with a lot of output
I had some trouble before with a lot of output, just try some things out for this.
n.b. One easy-to-demonstrate case is man bash when $MANPAGER is set to col -b.
The problems go away by setting $MANPAGER to a script that is simply col -b | cat.
It looks like the problem in that case is context switching between vim and the sub-program, probably combined with the fact that the vimL callback will be called individually for each chunk of text.
grep ctxt /proc/$(pgrep nvim)/status, shows that voluntary_ctxt_switches increases by 100,000 ~ 300,000 when the $MANPAGER is col -b, but only abound 3,000 when it's effectively col -b | cat.
b:changedtick increases by about 1000 for the col -b | cat case, and about 20,000 for the col -b case.
The nvim python provider is a separate thread, so context switches would be done between the vimL callbacks and the python functions it uses.
Just a caveat to self on the measurements:
Not done under "sterile" conditions.
These b:changedtick and ctxt measurements were on separate runs, so they don't correspond to each other.
There is large variation between runs for each $MANPAGER. Sometimes the col -b version is essentially instant, sometimes the col -b | cat version appears as slow as the col -b version is usually.