zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: "Suraj N. Kurapati" <sunaku@riseup.net>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PR] vcs_info-examples: optimize +vi-git-untracked() #76
Date: Wed, 4 Aug 2021 10:55:03 +0200	[thread overview]
Message-ID: <YQpV5w3P+qbb5Yl0@isis.sigpipe.cz> (raw)
In-Reply-To: <20210628155736.6982862a@ratham>

# sunaku@riseup.net / 2021-06-28 15:57:36 -0700:
> On Sun, 27 Jun 2021 15:03:17 +0200, Roman Perepelitsa wrote:
> > On Sun, Jun 27, 2021 at 8:07 AM Suraj N. Kurapati wrote:
> > > Speed up the prompt on large and/or deep working directories [...]  
> > 
> > Do you have an estimate of the speedup? Numbers from at least one
> > repository on one machine would be useful to see.
> 
> I see a 4x speedup on a large Git-enabled home directory, as follows:
> 
>     $ time (git status --porcelain | wc -l)
>     212
>     0.01s user 0.02s system 0% cpu 9.021 total
> 
>     $ time (git status --porcelain | grep '??' &>/dev/null)
>     0.01s user 0.02s system 0% cpu 12.294 total
> 
>     $ time (git status --porcelain | grep -q '^?? ' 2>/dev/null)
>     0.01s user 0.01s system 0% cpu 3.097 total

this might be of interest (example code should be exemplary, no? :)

BACKGROUND REFRESH
  By default, git status will automatically refresh the index, updating
  the cached stat information from the working tree and writing out the
  result. Writing out the updated index is an optimization that isn’t
  strictly necessary (status computes the values for itself, but writing
  them out is just to save subsequent programs from repeating our
  computation). When status is run in the background, the lock held
  during the write may conflict with other simultaneous processes,
  causing them to fail. Scripts running status in the background should
  consider using git --no-optional-locks status (see git(1) for details).

-- 
roman


      parent reply	other threads:[~2021-08-04  8:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27  6:09 Suraj N. Kurapati
2021-06-27  9:13 ` Oliver Kiddle
2021-06-27 10:04   ` Frank Terbeck
2021-06-28 17:16   ` Suraj N. Kurapati
2021-06-27 13:03 ` Roman Perepelitsa
2021-06-28 22:57   ` Suraj N. Kurapati
2021-06-29  7:16     ` Roman Perepelitsa
2021-08-04  8:55     ` Roman Neuhauser [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YQpV5w3P+qbb5Yl0@isis.sigpipe.cz \
    --to=neuhauser@sigpipe.cz \
    --cc=roman.perepelitsa@gmail.com \
    --cc=sunaku@riseup.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).