Wednesday, May 31, 2017

Re: Vim startup profiling

On Fr, 26 Mai 2017, Ken Takata wrote:

> > Ok I save 100ms using the plugin manager vim-plug but not enough for me.
> > Is anyone can advise me or explain to me why some files are loaded twice and take twice or more times N msec:
> > - vim80/menu.vim
> > - vim80\filetype.vim
>
> > 096.000 047.000 044.000: sourcing D:\Logiciels\Vim\vim80/menu.vim
> > 096.000 072.000 025.000: sourcing D:\Logiciels\Vim\vim80\filetype.vim
>
> menu.vim uses `globpath()` to search some kind of files under the runtimepath.
> If you search `globpath` in menu.vim, you may find the following lines:
>
> let s:n = globpath(&runtimepath, "colors/*.vim")
> let s:n = globpath(&runtimepath, "keymap/*.vim")
> let s = globpath(&rtp, "spell/*." . enc . ".spl")
> let s:n = globpath(&runtimepath, "compiler/*.vim")
>
> Color schemes, keymaps, spell files and compiler plugins are searched when
> menu.vim is loaded.
> This is why it takes long time to be loaded.
>
> Unlike those items, file types are not listed automatically. If a user
> selects "Syntax" -> "Show File Types in Menu", they will be listed.
> If we use a similar way for color schemes etc., the startup time would be
> reduced.

I took a brief look into that. First, I don't think it would be easily
possible to avoid the globpath() for the colorschemes and other scripts.

The syntax script seems to be compile time dependent, so while this
works, I assume it does not work correctly for filetypes/syntax scripts
you installed as extra package and I guess this is not what we want for
colorschemes and the other script types.

I think, it could be beneficial, if globpath() and glob() did allow for
e.g. OR'ing the script, e.g. something like this should be a lot faster:

globpath(&runtimepath, "{colors,spell,keymap,compiler}/*.vim")

Because we could then manually filter the resulting list. Unfortunately,
this syntax is not supported by glob()/globpath(). That could be a
worthwhile addition.

Mit freundlichen Grüßen
Christian
--
Machen Sie sich erst einmal unbeliebt, dann werden Sie auch ernst
genommen.
-- Konrad Adenauer

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: