Tuesday, November 14, 2017

Re: Vim surprisingly slow?

On 2017-11-14 18:57, Nazri Ramliy wrote:
> On Sun, Nov 12, 2017 at 10:21 PM, Tim Chase <vim@tim.thechases.com>
> wrote:
> > If I change the "exec" to an "echo", it's as fast as I expect.
> >
> > Any idea what might be making the exec so slow?
>
> It's vim writing to disk that makes it slow. I ran it on SSD it's
> fast, on a spindle disk it's slow. I use fatrace[1] to see the file
> create/write/close operations done by vim. So vim is writing to the
> file for each line that matches the pattern.

Yes, this was on a spinning-rust disk rather than a SSD/NVME drive.
And yes, based on the command, it should be doing an open/write/close
for each line. However, I'm nigh certain I've done things like this
in the past (whether within vim or things like Bash/Python scripts)
and it's not nearly as painful. Besides, the OS (Debian in this case)
should be fairly aggressive in caching the recently-used filesystem
metadata, so I'd expect the first open/close to have some reasonable
overhead, but subsequent ones should be coming out of cache, not
directly read off the drive.

Thanks Nazri, Erik, and Christian for investigative work. :-)

-tim


--
--
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: