Friday, September 9, 2022

Re: Gvim taking a minute or more to start

On Thu, 8 Sept 2022, 19:29 Gary Johnson, <garyjohn@spocom.com> wrote:
On 2022-09-08, David Lowry-Duda wrote:
> >I'm pretty sure it's something about my configuration / plugins /
> >something (gvim -u NONE -U NONE takes about 5 seconds), but I'm
> >really struggling to diagnose the issue / work out which plugin is
> >responsible.  I've got a lot of plugins that I've added over the
> >years and I probably don't need all of them, but it would be nice
> >to which is the culprit rather than just start culling them at
> >random.
>
> Five seconds feels like a *really* long time for base gvim. I don't
> use Windows, so perhaps my scale is off. But this feels like an
> eternity.

If it takes 5 seconds to start gvim with no plugins, especially when
using a local SSD, something is very wrong someplace.  I just ran
this command on my Windows 10 PC (with a hard drive) from a Cygwin
prompt so that I could measure the time:

    $ time /cygdrive/c/Program\ Files/Vim/vim90/gvim -f -c scriptnames -cq

    real    0m0.216s
    user    0m0.000s
    sys     0m0.000s

I had it execute :scriptnames just so it would have something
to do before immediately quitting.  And that's with loading all
my plugins.  With "-N -u NONE -i NONE", the real time dropped
to 0.17 s.

I suspect that whatever is causing that 5-second startup time is
contributing to the read times of every file that gvim opens.
So, while 5 seconds is better than 30, solving that 5-second issue
may solve the rest.

Unfortunately, I don't anything about diagnosing issues with Windows
or security programs.

Okay, now that's REALLY weird.

Scriptnames slows things down a little as I have to scroll through a page or two, but if I open a Cygwin64 Terminal and run:

time /cygdrive/c/vim/gvim.exe -f -c "echo h" -cq

The result is 866 ms. Adding -u NONE -U NONE changes it to 197 ms.

Removing all the arguments results in a near-instantaneous gvim window popping up!

So if I run Windows gvim from a cygwin terminal it starts quickly but if I run it from a windows command prompt or from windows explorer, it takes ages. I've tried this lots of times & it seems to be repeatable (I even created 10 instances of gvim in a loop and they all appeared straightaway).

I tried removing the HOME environment variable from cygwin (it's not set to anything in the Windows system, whereas it's set to /home/al in cygwin) and ran the command again from the cygwin terminal and it took a long time to start. I reset HOME to /home/al and it still took a long time to start! Opening a new cygwin terminal resulted in a quick start again. This is really weird!

In /home/al there's a .vimrc that contains:

let &rtp ='/cygdrive/c/vim/vimfiles,'.&rtp
runtime! vimrc

Removing /home/al/.vimrc seems to make no difference to the results.

I think I'm even more confused now!

I should probably note that this is on a different work PC to the one I was using for tests yesterday, but I have 3 PCs that all show the slow start-up problem.

Al

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOaJ26RqxA16BkkrgcXVTSBtK3a0Buma13EhMK9A%2BPhr23GK%3DQ%40mail.gmail.com.

No comments: