Tuesday, November 14, 2017

Re: Vim surprisingly slow?

On Di, 14 Nov 2017, Tim Chase wrote:

> On 2017-11-14 00:08, Erik Falor wrote:
> > Here's what iotop shows during a typical run:
> >
> > Total DISK READ : 0.00 B/s | Total DISK WRITE : 1372.27 K/s
> > Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 2.68 M/s
> > TID PRIO USER DISK READ DISK WRITE SWAPIN IO>
> > COMMAND 304 be/3 root 0.00 B/s 0.00 B/s 0.00 % 80.22 %
> > [jbd2/nvme0n1p2-] 17734 be/4 fadein 0.00 B/s 1372.27 K/s 0.00
> > % 0.89 % vim -c source slow.vim data.json
>
> I see similar behavior on mine, with iotop reporting 80-90% of the
> usage on the home partition of my drive (where I was writing the file
> in question).
>
> I started poking around in the vim source, but nothing stands out to
> me other than possibly attempting to run autocmds for every ".w!>>"
> which might have some sort of amplification factor.
>
> I don't have a good way to see if it's actually (re)reading the
> output file (and possibly executing autocmds on it or other vast
> labor) every time it appends to it.
>
> The difference between the "exec '.w>>'" case and the other tests is
> striking. The other tests complete in under a second. Meanwhile,
> the version attempting to append the line to the file is taking
> *minutes* to write/append ~5000 lines.

Some more things to try:
Does `:set ei=all` or using `:noa :.w` make a difference perhaps?
Also does it work better if you explicitly use e.g. writefile('', 'a')?

Christian
--
Warum haben einige Trabbis eine heizbare Heckscheibe?
Damit man beim Schieben warme Hände hat.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: