Re: Improving startup time for autocommands

۴۴ بازدید
رفتن به اولین پیام خوانده‌نشده

Manas

خوانده‌نشده،
۲۵ بهمن ۱۳۹۹، ۵:۵۰:۰۸۱۳۹۹/۱۱/۲۵
به v...@vim.org
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?

Thank you
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India

Paul

خوانده‌نشده،
۲۵ بهمن ۱۳۹۹، ۶:۳۳:۳۰۱۳۹۹/۱۱/۲۵
به v...@vim.org
On Sat, Feb 13, 2021 at 04:19:44PM +0530, 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?

See if you can use the FileType event instead of BufEnter.
signature.asc

Gary Johnson

خوانده‌نشده،
۲۵ بهمن ۱۳۹۹، ۱۶:۵۱:۴۶۱۳۹۹/۱۱/۲۵
به vim...@googlegroups.com
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

پاسخ به همه
پاسخ به نویسنده
فرستادن
0 پیام جدید