vim-ruby feels too slow

Eric Hodel drbrain at
Wed Apr 5 16:56:37 EDT 2006

I remember first using vim with ruby highlighting and indenting on a  
Pentium 133 Laptop with 40MB of memory something like four years ago.

I remember it being slow, but it was a Pentium 133 with limited  
memory.  I didn't expect much.

Now I have a 1.5GHz G4 powerbook with 2GB of memory.

vim feels slower now than it did on that Pentium 133.

I know that the indenting and highlighting are vastly improved for  
vim, but it doesn't seem that it should be this slow.  Sometimes  
opening a ruby file pegs my CPU for five to ten seconds (usually one  
of the 100k internal Rails files).

Here's a semi-scientific concrete example that just shows starting  
up.  I'll ignore editing because that's much more difficult to  
quantify, but editing can be just as slow in certain sections of  
files that take a long time to open.

To start vim on my machine takes about 1/3 of a second, at best 1/5  
of a second:

$ time vim -c ':q'

real    0m0.216s
user    0m0.070s
sys     0m0.110s
$ time vim -c ':q'

real    0m0.318s
user    0m0.125s
sys     0m0.153s

I have a test suite with 391 lines in it for 13k:

$ wc test/controllers/entry_controller_test.rb
      391     917   13181 test/controllers/entry_controller_test.rb

There's really nothing fancy in the file.  Just a class with a bunch  
of methods, a couple of Hashes and strings and so-on.

If I move all the ruby-specific vim-ruby files aside I get between .6  
and .75 seconds when starting ruby:

$ find ~/.vim/ -name "ruby*"
$ time vim -c ':q' test/controllers/entry_controller_test.rb

real    0m0.595s
user    0m0.291s
sys     0m0.224s
$ time vim -c ':q' test/controllers/entry_controller_test.rb

real    0m0.751s
user    0m0.310s
sys     0m0.229s

If I add the files back:

$ find ~/.vim/ -name "ruby*"

I see between 1 second and 1.5 seconds to start the same file:

$ time vim -c ':q' test/controllers/entry_controller_test.rb

real    0m0.985s
user    0m0.623s
sys     0m0.259s
$ time vim -c ':q' test/controllers/entry_controller_test.rb

real    0m1.574s
user    0m0.615s
sys     0m0.252s

For real punishment I can give you r2ctestcase.rb from ruby2c.

$ wc r2ctestcase.rb
     1351    3522   51231 r2ctestcase.rb
$ time vim -c ':q' r2ctestcase.rb

real    0m3.985s
user    0m2.788s
sys     0m0.498s

In case I'm actually doing something stupid in my .vimrc, here it  
is.  I don't believe I've changed it substantially since I started  
using vim.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vimrc
Type: application/octet-stream
Size: 2201 bytes
Desc: not available
Url : 
-------------- next part --------------

Eric Hodel - drbrain at -
This implementation is HODEL-HASH-9600 compliant

More information about the vim-ruby-devel mailing list