Saturday, February 13, 2021

Re: Improving startup time for autocommands

On 2021-02-13, Manas wrote:
> Hi everyone, I am facing some delay in startup time and doing
> `--startuptime`, I can see that autocommands are the reason for the
> delay. Specifically those autocmds where I am using BufEnter etc. type
> events. I have quite a number of autocmds for various FileType(s)
> and various events.
>
> Can I get some suggestions on how to improve upon these or whether
> I should switch autocmds with something else to improve upon
> startuptime?

When I run vim with --startuptime, I see only two autocommand
events, "BufEnter autocommands" and "VimEnter autocommands", and
they each consume only a few milliseconds.

If you are seeing significantly longer times than these, I would
suspect one or two of your autocommands are taking an
extraordinarily long time to run. Since --startuptime doesn't
resolve individual autocommands, and since -V doesn't include times,
your best bet for finding the problem may be some sort of binary
search for the offending autocommand(s). That is, comment-out half
of your autocommands, check --startuptime times again, see how much
they improved, then comment-out or un-comment-out half of the
appropriate set and repeat.

Once you find the one(s) taking a long time, you can post them here
for some advice on improving those times.

Regards,
Gary

--
--
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/20210213215148.GD16915%40phoenix.

No comments: