# Re: \[hacky PATCH 0/2\] speeding up trivial for-each-ref invocations

- From: Jeff King \<hidden\>
- Date: 2021-09-05 12:49:16 
- List: git
- Page: https://ratatoskr.run/git/2021/09/7901297
- Thread: https://ratatoskr.run/git/2021/09/7901261/t.md

```text
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

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
```
