Sunday, July 16, 2023

Re: Improving vim startuptime

On 2023-07-17, Manas wrote:
> On Sun, Jul 16, 2023 at 01:01:23PM -0700, Gary Johnson wrote:
> > All of those things are possible and probably good ideas, but
> > driving them all to zero would improve the time by only 656 ms and
> > still leaves you with an annoying 2.1 s unaccounted for.
> >
> > The output of hyperfine shows only the program name. What command
> > are you executing? If the command was something like this,
> >
> > vim -cq
> >
> > then I can't explain what vim could be doing from the time it
> > printed "--- VIM STARTED ---" in the log until it exited.
> >
> > It would be interesting to see what hyperfine measures with the
> > command
> >
> > vim -N -u NONE -i NONE -X -cq
> >
> I was using `hyperfine -i /usr/bin/vim`.
>
> But I tested with above commands too.
>
> ```
> $ hyperfine "vim -cq"
> Benchmark 1: vim -cq
> Time (mean ± σ): 2.414 s ± 0.017 s [User: 0.358 s, System: 0.048 s]
> Range (min … max): 2.392 s … 2.447 s 10 runs
>
>
> $ hyperfine "vim -N -u NONE -i NONE -X -cq"
> Benchmark 1: vim -N -u NONE -i NONE -X -cq
> Time (mean ± σ): 2.047 s ± 0.006 s [User: 0.032 s, System: 0.010 s]
> Range (min … max): 2.039 s … 2.056 s 10 runs
> ```

Interesting! That's crazy. It should not take nearly that long to
execute that last command. Vim is not doing anything but starting
without loading any files, then immediately exiting.

Is that what you observe without using hyperfine?

I've never used hyperfine; I've just read about it since your post.
I usually run a command with the time command, throw away the first
run because it includes the time time to fill caches, then average
the next three.

For example:

$ time vim -N -u NONE -i NONE -X -cq

real 0m0.030s
user 0m0.013s
sys 0m0.016s

What is the output of that command on your system?

I'm thinking that maybe we should try running vim under strace. Try
this and see what strace.out shows the running time to be.

$ strace -f -tt -o strace.out --summary vim -N -u NONE -i NONE -X -cq

The summary total time varies, but I get about 10 ms.

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/20230716204737.GN6600%40phoenix.

No comments:

Post a Comment