Slow vim loading , how to find it out

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Slow vim loading , how to find it out

Aaron Lewis-2
Hi,
   Guess i've enabled too many plugins , vim on my Gentoo loads really slow ( approximately 3 seconds ) ,
   is there anyways to debug , and find out the worst time consumers ?

 Thanks.

--
Best Regards,
Aaron Lewis - PGP: 0xDFE6C29E ( http://keyserver.veridis.com )
Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Dominique Pellé
Aaron Lewis wrote:

> Hi,
>    Guess i've enabled too many plugins , vim on my Gentoo loads really slow
> ( approximately 3 seconds ) ,
>    is there anyways to debug , and find out the worst time consumers ?
>  Thanks.

There is a way.  See:
  :help --startuptime
  :help slow-start

You need at least Vim-7.2.286 to use "vim --startuptime <fname>"

Cheers
-- Dominique

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Aaron Lewis-2
On Fri, Dec 17, 2010 at 01:41:17PM +0100, Dominique Pellé wrote:

> Aaron Lewis wrote:
>
> > Hi,
> >    Guess i've enabled too many plugins , vim on my Gentoo loads really slow
> > ( approximately 3 seconds ) ,
> >    is there anyways to debug , and find out the worst time consumers ?
> >  Thanks.
>
> There is a way.  See:
>   :help --startuptime
>   :help slow-start
>
> You need at least Vim-7.2.286 to use "vim --startuptime <fname>"

Cool enough , thanks !

--
Best Regards,
Aaron Lewis - PGP: 0xDFE6C29E ( http://keyserver.veridis.com )
Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Daniel Corrêa
In reply to this post by Dominique Pellé
>> Hi,
>>    Guess i've enabled too many plugins , vim on my Gentoo loads really slow
>> ( approximately 3 seconds ) ,
>>    is there anyways to debug , and find out the worst time consumers ?
>>  Thanks.

You can also check which scripts are loaded with :script, and maybe disable some that you don't need.

Cheers
        Daniel

(45) 9938.3993
www.meadiciona.com/dnlcorrea

On 17/12/2010, at 10:41, Dominique Pellé wrote:

> Aaron Lewis wrote:
>
>> Hi,
>>    Guess i've enabled too many plugins , vim on my Gentoo loads really slow
>> ( approximately 3 seconds ) ,
>>    is there anyways to debug , and find out the worst time consumers ?
>>  Thanks.
>
> There is a way.  See:
>  :help --startuptime
>  :help slow-start
>
> You need at least Vim-7.2.286 to use "vim --startuptime <fname>"
>
> Cheers
> -- Dominique
>
> --
> 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 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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Nikolay Aleksandrovich Pavlov
In reply to this post by Aaron Lewis-2
Reply to message «Slow vim loading , how to find it out»,
sent 14:31:37 17 December 2010, Friday
by Aaron Lewis:

If --startuptime does not fit your needs, you may use the following command:
    vim --cmd 'profile start profile.log' \
        --cmd 'profile func *' \
        --cmd 'profile file *' \
        -c 'profdel func *' \
        -c 'profdel file *' \
        -c 'qa!'
You will get all timings in the profile.log. Table with function timings will be
present at the end of the file, to get per-script timings, use the following
script:

    " Open profile.log file in vim first
    let timings=[]
    g/^SCRIPT/call add(timings, [getline('.')[len('SCRIPT  '):],
matchstr(getline(line('.')+1), '^Sourced \zs\d\+')]+map(getline(line('.')+2, line('.')+3),
'matchstr(v:val, ''\d\+\.\d\+$'')'))
    enew
    call setline('.', ['count total (s)   self (s)  script']+map(copy(timings),
'printf("%5u %9s   %8s  %s", v:val[1], v:val[2], v:val[3], v:val[0])'))

This will open a new file containing just the same table as at the end of
profile.log, but 1) for scripts, not for functions, 2) unsorted.

Original message:
> Hi,
>    Guess i've enabled too many plugins , vim on my Gentoo loads really slow
> ( approximately 3 seconds ) ,
>    is there anyways to debug , and find out the worst time consumers ?
>
>  Thanks.

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Erik Falor
In reply to this post by Aaron Lewis-2
On Fri, Dec 17, 2010 at 07:31:37PM +0800, Aaron Lewis wrote:
> Hi,
>    Guess i've enabled too many plugins , vim on my Gentoo loads really slow
> ( approximately 3 seconds ) ,
>    is there anyways to debug , and find out the worst time consumers ?
>
>  Thanks.

If your Vim is fairly recent, try this:

vim --startuptime thetimes.txt

The --startuptime argument was added sometime in the 7.2 days.
7.3.0 and above has it for sure.

--
Erik Falor
Registered Linux User #445632 http://counter.li.org

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

scott-268
On Friday 17 December 2010 16:07:12 Erik Falor wrote:

> If your Vim is fairly recent, try this:

> vim --startuptime thetimes.txt

> The --startuptime argument was added sometime in the 7.2 days.
> 7.3.0 and above has it for sure.

fascinating -- i didn't know about this one -- makes me wonder
how much i want to keep using CSApprox -- it's using over half
of all startup time -- then again, vim would be a shadow of
its former self without it, a conundrum

sc

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Tom Link-3
> it's using over half of all startup time

In this case it won't work because you probably want to load the
plugin on every startup, but you can use plugins like asneeded,
tplugin to load plugins on demand (e.g. when invoking a command for
the first time) or vim-addon-manager or pathogen to enable a plugin
after startup. This way you have better control over which plugins are
loaded when.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

scott-268
On Friday 17 December 2010 23:51:27 Tom Link wrote:

> > it's using over half of all startup time

> In this case it won't work because you probably want to load
> the plugin on every startup, but you can use plugins like
> asneeded, tplugin to load plugins on demand (e.g. when
> invoking a command for the first time) or vim-addon-manager
> or pathogen to enable a plugin after startup. This way you
> have better control over which plugins are loaded when.

i'm not sure what you're saying won't work

what does work is this:  i removed CSApprox from my autoload,
doc, and plugin paths, and my startup time for vim dropped
from 194 milliseconds to 60 ms -- the last thing i want is
more plugins -- i'm down to just netrw now -- when i need to
see pretty colors i'll use gvim

sc

--
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
Reply | Threaded
Open this post in threaded view
|

[SOLVED] Re: Slow vim loading , how to find it out

Aaron Lewis-2
In reply to this post by Daniel Corrêa
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks for all of your help on this topic !

I'm checking scripts provided by Zyx out , and :script also helps out ,
yeah , at least --startuptime did the job at present ;-)

- --
Best Regards,
Aaron Lewis - PGP: 0xDFE6C29E ( http://keyserver.veridis.com )
Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJNDMDXAAoJECSSp9Df5sKeZhYP/Al6S8wLJTwgZvslhHaaoGEx
rc3H9AO2MVwD3U888gVLw9tKPhA0tbJC39ygR5hRD+HPuPHNmthyQTRdK47grxTV
PzRF8nkmfqiJtzUqdT3OqL+eM7RG4bAJYgzpfkbLUKkm+rwjgpnp9Md5JV71IIC/
AYjeFjMs/x+mSAgtvBfSdu9BdcRLm5dcU/etXx2lYneoGL5Sp7Q5qR5fWI2j/LRj
Y8JzQzHzv3EW/znMqbpQtLio54ugqgSvXuVDZn56ASPwrVdzDjp9dZv1z7Dw/SwH
p2X0QNl68gxzE7UMsyb0IyqeBbzA5U06cVDT+91fv4UTHx2N7DqIYmhWtN5gIJdw
LYFbg0NDCgZ2M5fULNw/IJQG4OihorFXK6WSNFW4ZWorqvAWggP10tqNbKnEfVYB
9eIjia4cMokUoJh0ywOvzMtP/+CVkmS+JbjaafPXi8JTW7BCzvnuhut+xcxToFpd
uFGMu3mOOgSYYV7styNQ81kWyxfZyKu2H5Ih3NvXDhNcEWwp2TsXhtMrkK0xu2ca
ht0z2IjSjrQG57NEOo/ST+QPkMT2F0qOgTWECq8KBN6PWOV7YpaoUTIiTT77Qo3m
JRgkm3OhUcsn0SiJGCcaos3r0AZtT9OzNqqiQYFHp+apSZvL1BkUgpTCtEXUBEjy
D+SNjeHRDASN+5xNXm8R
=O8cH
-----END PGP SIGNATURE-----

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Chris Jones-44
In reply to this post by scott-268
On Sat, Dec 18, 2010 at 01:57:37AM EST, sc wrote:

> On Friday 17 December 2010 23:51:27 Tom Link wrote:
>
> > > it's using over half of all startup time
>
> > In this case it won't work because you probably want to load
> > the plugin on every startup, but you can use plugins like
> > asneeded, tplugin to load plugins on demand (e.g. when
> > invoking a command for the first time) or vim-addon-manager
> > or pathogen to enable a plugin after startup. This way you
> > have better control over which plugins are loaded when.
>
> i'm not sure what you're saying won't work
>
> what does work is this:  i removed CSApprox from my autoload,
> doc, and plugin paths, and my startup time for vim dropped
> from 194 milliseconds to 60 ms -- the last thing i want is
> more plugins -- i'm down to just netrw now -- when i need to
> see pretty colors i'll use gvim

Or this (?) from the CSApprox web page:

‘If for some reason this transparent method isn't suitable to you (for
instance if your environment can't be configured to meet the
|csapprox-requirements|, or you need to work in Vim 6), another option
is also available: using the |:CSApproxSnapshot| command to create a new
GUI/88-/256-color terminal colorscheme.  To use this command, a user
would generally start GVim, choose a colorscheme that sets up the
desired colors, and then use |:CSApproxSnapshot| to create a new
colorscheme based on those colors that works in high color terminals.
This method is more flexible than the transparent mode and works in more
places, but also requires more user intervention, and makes it harder to
deal with colorschemes being updated and such.’

cj

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

scott-268
On Saturday 18 December 2010 10:33:06 Chris Jones wrote:

> Or this (?) from the CSApprox web page:

> ‘If for some reason this transparent method isn't suitable to
> you (for instance if your environment can't be configured to
> meet the

> |csapprox-requirements|, or you need to work in Vim 6),
> | another option

> is also available: using the |:CSApproxSnapshot| command to
> create a new GUI/88-/256-color terminal colorscheme.  To use
> this command, a user would generally start GVim, choose a
> colorscheme that sets up the desired colors, and then use
> |:CSApproxSnapshot| to create a new colorscheme based on
> those colors that works in high color terminals. This method
> is more flexible than the transparent mode and works in more
> places, but also requires more user intervention, and makes
> it harder to deal with colorschemes being updated and such.’

woah!  cool beans chris -- i will be checking into this

sc

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Benjamin R. Haskell-8
In reply to this post by scott-268
On Sat, 18 Dec 2010, sc wrote:

> On Friday 17 December 2010 23:51:27 Tom Link wrote:
>
>>> it's using over half of all startup time
>
>> In this case it won't work because you probably want to load the
>> plugin on every startup, but you can use plugins like asneeded,
>> tplugin to load plugins on demand (e.g. when invoking a command for
>> the first time) or vim-addon-manager or pathogen to enable a plugin
>> after startup. This way you have better control over which plugins
>> are loaded when.
>
> i'm not sure what you're saying won't work
>
> what does work is this:  i removed CSApprox from my autoload, doc, and
> plugin paths, and my startup time for vim dropped from 194
> milliseconds to 60 ms -- the last thing i want is more plugins -- i'm
> down to just netrw now -- when i need to see pretty colors i'll use
> gvim

Unless you're starting and stopping Vim hundreds of times per day, the
amount of time it took to write that email and change the way you use
CSApprox dwarfs the time savings you'll ever see from removing it from
startup.

I can see the OP wanting to reduce Vim startup below three seconds --
that's a perceptible delay.  But the difference in startup time between
.194 seconds and .060 seconds is barely noticeable.

Probably counter-productive to my case, but if you want to see the
difference:

$ perl -lwe 'print 1; select "","","",0.194; print 2'
$ perl -lwe 'print 1; select "","","",0.060; print 2'

It's only noticeable if you're really focusing on it.  It's pretty
insignificant in the scope of other stuff that's happening (hitting
enter or double-clicking, waiting for the window to redraw, etc. etc.).

--
Best,
Ben

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

scott-268
On Saturday 18 December 2010 12:51:57 Benjamin R. Haskell wrote:

> Unless you're starting and stopping Vim hundreds of times per
> day, the amount of time it took to write that email and
> change the way you use CSApprox dwarfs the time savings
> you'll ever see from removing it from startup.

> I can see the OP wanting to reduce Vim startup below three
> seconds -- that's a perceptible delay.  But the difference in
> startup time between .194 seconds and .060 seconds is barely
> noticeable.

> Probably counter-productive to my case, but if you want to see
> the difference:

> $ perl -lwe 'print 1; select "","","",0.194; print 2'
> $ perl -lwe 'print 1; select "","","",0.060; print 2'

> It's only noticeable if you're really focusing on it.  It's
> pretty insignificant in the scope of other stuff that's
> happening (hitting enter or double-clicking, waiting for the
> window to redraw, etc. etc.).

i freely admit to being an unapologetic nit-picker -- i like
things to happen fast when i hit enter -- i do notice the
difference, especially when i'm paying attention, and if not
it's just a happy visceral response to a snappy machine

i am very sensitive to response times, having worked years on
IBM mainframes before moving on to other things

thanx to chris for pointing it out, not to mention matt's
diligence in creating a masterful plugin, i was able to create
a CSASnapshot of biogoo, re-de-install CSApprox, and now vim
starts in 63 milliseconds AND has all the colorful bells and
whistles -- the best of both worlds (i can keep cursorline
turned on for both gvim and vim)

sc

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Chris Jones-44
In reply to this post by Benjamin R. Haskell-8
On Sat, Dec 18, 2010 at 01:51:57PM EST, Benjamin R. Haskell wrote:

[..]

> Unless you're starting and stopping Vim hundreds of times per day,

See below.

> the  amount of time it took to write that email and change the way you
> use  CSApprox dwarfs the time savings you'll ever see from removing it
> from  startup.
>
> I can see the OP wanting to reduce Vim startup below three seconds --
> that's a perceptible delay.  But the difference in startup time
> between  .194 seconds and .060 seconds is barely noticeable.

But with.. say, a dozen such plugins or more, this could climb to
something like a couple of seconds.

Now suppose you use Vim to edit your email messages (a common setup if
mutt is your mailer of choice) this may result in something like a total
4-5 seconds lag every time you hit the ‘L’ key (reply-to-list) and then
it does become noticeable.

OTOH, this pales in comparison with wasting hours (days?) when some
exotic and no-longer maintained plugin that one may have installed years
ago and completely forgotten about, starts playing foul in mysterious
ways when upgrading Vim or the OS.

This is why I suggested using the plugin in ‘batch mode’, so-to-speak,
and disabling it after after converting the color schemes.

cj



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Slow vim loading , how to find it out

Spencer Collyer
In reply to this post by Aaron Lewis-2
On Fri, 17 Dec 2010 19:31:37 +0800, Aaron Lewis wrote:
> Hi,
>    Guess i've enabled too many plugins , vim on my Gentoo loads
> really slow ( approximately 3 seconds ) ,
>    is there anyways to debug , and find out the worst time consumers ?
>
>  Thanks.
>

Bit late replying to this I know, but something I've not seen mentioned
in the replies you've received so far is adding the '-X' flag when you
start Vim. This stops Vim attempting to connect to the X server, which
(depending upon how it's been compiled) it will do even if run in a
console. This can add an appreciable delay to the startup.

--
<<< Eagles may soar, but weasels don't get sucked into jet engines >>>
17:39 up 1 day 10:54, 1 user, load average: 0.00, 0.01, 0.14
Registered Linux User #232457 | LFS ID 11703

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