Tuesday, December 17, 2013

Re: vim is very slow when opening multiple , large , gzip files

On Tuesday, December 17, 2013 12:28:54 PM UTC-6, ping wrote:
> I know it might be normal, how can I expect it to be same fast as small/single txt file?
> but the thing is `less` is much faster, in the same situation...
>
>
> so this is how I opened them:
>
>
>
> vim *.gz
>
>
> and I got all these gz files opened. each of the gz files is about 4M Bytes. so far nice and the vim magic works (display gzip file directly) great.
>
>
>
> then I :bn to move the next buffer, it took long time...
>
>
> it seems those files displayed as buffers were actually not "opened" unless I ever move to them each at least once.
>
>

Correct. When you call Vim with *.gz you're just setting the argument list. Vim doesn't actually read the buffer into memory until you edit the file.

>
> OK, assuming after I moved to a file it is now really opened, but then after that even switching between 2 already "opened" buffers that I ever moved to , are still slow -- not as slow as the first time when I try to :bn to, but still need to wait around 6 or 7 seconds...
>
>  
> is there any way / knobs to make it faster in this situation?
>

With default settings Vim will discard the buffer text and re-read it the next time you visit the buffer.

If you set the 'hidden' option then Vim keeps the buffer contents in memory instead. This is mostly designed to let you keep unsaved changes around when you switch buffers, but it also means Vim doesn't need to re-read the file when you're just switching between unmodified buffers.

And naturally, since you're relying on autocmds to "read" the file by decompressing it, it's going to take a bit longer to load these compressed files than if you had loaded a plaintext file.

--
--
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/groups/opt_out.

No comments:

Post a Comment