Monday, October 23, 2017

Re: Vim startup profiling

Hi,

2017/5/26 Fri 22:36:40 UTC+9 Ken Takata wrote:
> > 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 wrote a patch for reduce the loading the of menu.vim by skip using
globpath().

https://bitbucket.org/k_takata/vim-ktakata-mq/src/bf92d701bca2ef46f6caa64aae89438e039370bb/improve-loading-menu.vim.patch?at=default&fileviewer=file-view-default

Instead of searching colors/*.vim and other files, the following menuitems are
added in the menu:

Edit > Show Color Schemes in Menu
Edit > Show Keymaps in Menu
Tools > Show Compiler Settings in Menu

If these menuitems are selected, all available colorschemes etc. are shown
in the menu. If a user want to load them at startup, the following line
can be added in .vimrc:
:let do_globpath_menus = 1
(This is similar to `:let do_syntax_sel_menu = 1`.)


In my environment, the loading time of menu.vim is:
Without this patch: 30 - 50 ms
Skip using globpath: 15 - 20 ms

Regards,
Ken Takata

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