vim-ruby feels too slow

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

vim-ruby feels too slow

Eric Hodel
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*"
/Users/drbrain/.vim//compiler/ruby.vim.bak
/Users/drbrain/.vim//compiler/rubyunit.vim
/Users/drbrain/.vim//ftdetect/ruby.vim.bak
/Users/drbrain/.vim//ftplugin/ruby.vim.bak
/Users/drbrain/.vim//indent/ruby.vim.bak
/Users/drbrain/.vim//syntax/doc/ruby.txt.bak
/Users/drbrain/.vim//syntax/ruby.vim.bak
$ 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*"
/Users/drbrain/.vim//compiler/ruby.vim
/Users/drbrain/.vim//compiler/rubyunit.vim
/Users/drbrain/.vim//ftdetect/ruby.vim
/Users/drbrain/.vim//ftplugin/ruby.vim
/Users/drbrain/.vim//indent/ruby.vim
/Users/drbrain/.vim//syntax/doc/ruby.txt
/Users/drbrain/.vim//syntax/ruby.vim

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.




--
Eric Hodel - [hidden email] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com



_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: vim-ruby feels too slow

Doug Kearns
G'day Eric,

Sorry for the slow response.

On Wed, Apr 05, 2006 at 01:56:37PM -0700, Eric Hodel wrote:
> I remember first using vim with ruby highlighting and indenting on a  
> Pentium 133 Laptop with 40MB of memory something like four years ago.

That'd be before I ruined it. ;-)
 
> 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.

The highlighting is certainly slower than it was back then - it's doing
considerably more.
 
> 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).

Can you send me an example?
 
> 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:

This seems awfully slow to me...
 

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

You don't have any of the distributed files in $VIMRUNTIME?

<snip - 'performance' data>
 
FWIW, I'm not too surprised by these numbers. Do the other similar
syntax files perform significantly faster for you?

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

Can you forward this one to me, please?
 

> $ 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.

I can't see anything obvious in there but you can always compare it to
vim -u NONE

Thanks,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: vim-ruby feels too slow

Doug Kearns
On Wed, Apr 12, 2006 at 06:25:17PM +1000, Doug Kearns wrote:

<snip>
 
> FWIW, I'm not too surprised by these numbers. Do the other similar
> syntax files perform significantly faster for you?

For example, the runtime/autoload/phpcomplete.vim file in Vim 7 takes
almost 4 seconds to open for me.

<snip>

Regards,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel