git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: ZheNing Hu <adlternative@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [hacky PATCH 0/2] speeding up trivial for-each-ref invocations
Date: Mon, 6 Sep 2021 21:30:45 +0800	[thread overview]
Message-ID: <CAOLTT8SYx4f8x-0zjXLJVOpW4-Mj34mjsfwr6tWo0PbZAV9B0w@mail.gmail.com> (raw)
In-Reply-To: <YTS8yiYwR+eeZf4+@coredump.intra.peff.net>

Jeff King <peff@peff.net> 于2021年9月5日周日 下午8:49写道:
>
> On Sun, Sep 05, 2021 at 04:19:53PM +0800, ZheNing Hu wrote:
>
> > > In this version there are 2 patches, tested against 'git for-each-ref
> > > --format="%(objectname) %(refname)"' on a fully packed repo with 500k
> > > refs:
> > >
> >
> > Regarding this 500k refs, is there any way I can reproduce it?
>
> Try this in a clone of linux.git (or any other repo):
>
>   git rev-list HEAD |
>   head -500000 |
>   perl -lne 'print "create refs/foo/$. $_"' |
>   git update-ref --stdin
>
>   git pack-refs --all --prune
>

Sorry, It seems that the above command is difficult to complete on my
machine (it took more than ten minutes). It may be stuck on git update-ref.
So I tried to reproduce it in a repo which containing 76K refs:

Benchmark #1: jk-for-each-ref-speedup~2: git for-each-ref
--format='%(refname) %(objectname)'
 Time (mean ± σ):     108.0 ms ±   1.9 ms    [User: 55.2 ms, System: 52.1 ms]
 Range (min … max):   105.7 ms … 112.4 ms    26 runs

Benchmark #2: jk-for-each-ref-speedup~1: git for-each-ref
--format='%(refname) %(objectname)'
 Time (mean ± σ):      88.2 ms ±   1.7 ms    [User: 44.8 ms, System: 43.1 ms]
 Range (min … max):    85.8 ms …  93.2 ms    32 runs

Benchmark #3:jk-for-each-ref-speedup: git for-each-ref
--format='%(refname) %(objectname)'
  Time (mean ± σ):      69.0 ms ±   2.0 ms    [User: 22.7 ms, System: 46.1 ms]
 Range (min … max):    66.2 ms …  74.1 ms    41 runs

For %(refname) and %(objectname), this performance optimization is
indeed amazing.

> Though I actually think for these tests that it is not important that
> each ref point to a unique commit (we are not opening up the objects at
> all, and just treating the oids as strings).
>
> -Peff

Thanks.
--
ZheNing Hu

  reply	other threads:[~2021-09-06 13:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 12:40 [hacky PATCH 0/2] speeding up trivial for-each-ref invocations Jeff King
2021-09-04 12:41 ` [PATCH 1/2] ref-filter: hacky "streaming" mode Jeff King
2021-09-05  8:20   ` ZheNing Hu
2021-09-05 13:04     ` Jeff King
2021-09-07  5:28       ` ZheNing Hu
2021-09-07 18:01         ` Jeff King
2021-09-09 14:45           ` ZheNing Hu
2021-09-10 14:26             ` Jeff King
2021-09-15 12:27               ` ZheNing Hu
2021-09-15 14:23                 ` ZheNing Hu
2021-09-16 21:45                   ` Jeff King
2021-09-20  7:42                     ` ZheNing Hu
2021-09-16 21:31                 ` Jeff King
2021-09-05 13:15     ` Jeff King
2021-09-07  5:42       ` ZheNing Hu
2021-09-04 12:42 ` [PATCH 2/2] ref-filter: implement "quick" formats Jeff King
2021-09-05  8:20   ` ZheNing Hu
2021-09-05 13:07     ` Jeff King
2021-09-06 13:34       ` ZheNing Hu
2021-09-07 20:06       ` Junio C Hamano
2021-09-05  8:19 ` [hacky PATCH 0/2] speeding up trivial for-each-ref invocations ZheNing Hu
2021-09-05 12:49   ` Jeff King
2021-09-06 13:30     ` ZheNing Hu [this message]
2021-09-07 17:28       ` Jeff King
2021-09-09 13:20         ` ZheNing Hu
2021-09-06  6:54 ` Patrick Steinhardt

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAOLTT8SYx4f8x-0zjXLJVOpW4-Mj34mjsfwr6tWo0PbZAV9B0w@mail.gmail.com \
    --to=adlternative@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).