Web lists-archives.com

Performance regression in `git branch` due to ref-filter usage




While working on reference code, I was running `git branch` under
`strace`, when I noticed that `$GIT_DIR/HEAD` was being `lstat()`ed and
`read()` 121 times. This is in a repository with 114 branches, so
probably it is being run once per branch. The extra work makes a
measurable difference to the (admittedly, short) runtime.

As recently as 2.12.3 the file was only read 4 times when running the
same command [1].

The regression bisects to

    949af0684c (branch: use ref-filter printing APIs, 2017-01-10)

It would be nice if these extra syscalls could be avoided.

I haven't checked whether other commands have similar regressions.

Michael

[1] One wonders why the file has to be read more than once, but that's a
different story and probably harder to fix.