Saturday, February 18, 2012

Re: How to debug when vim becomes quite slow?

On 02/18/12 08:15, kindle4ever wrote:
> When i open a file with 4000line code, the response of vim becomes quit
> slow. At the mean time i input a word, vim costs 40% cpu. After switching
> to another vimrc, it works fine again.
> Can anyone tell me how to debug in vim? Because the vimrc script is written
> by me and i can't locate the error after checking for a long time.

I'd start by investigating the following:

- do you have some large register-value stored in your .viminfo?
(would slow startup, but shouldn't slow use once you've started)

- exceptionally long lines with certain syntax files (you'd see
the symptoms on certain file-types but not others; you mention 4k
lines, but not the max line-length or file-size)

- mappings that are waiting for pending keystrokes to discern
them from each other (check if changing 'timeoutlen' alters
performance)

- some particular search (whether a stored pattern in your
default search register, or a :match command) that is highly
inefficient (control+C might help if you're stuck in a delay;
clearing the various search/:match settings should improve this)

- you might have some CursorHold or CursorHoldI event that is
doing time-consuming things

- you might be something at high frequencies (check the values of
'updatecount' and 'updatetime')

- you might be writing to an exceptionally slow device
(swap-files, backup files, etc; written to a floppy or a network
drive with high latency or a hard-drive that is about to die)


You can always bisect your vimrc to track down the offending
line(s). Including your vimrc might also help folks track down
any issues.

-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

No comments: