git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
May 17, 2017, 11:14 UTC
Message-ID
<dfc3a334-8047-26b0-1142-81c703010507@alum.mit.edu>

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.

Next: Jeff King
Message 1 of 3 in “Performance regression in `git branch` due to ref-filter usage”
  1. Michael HaggertyMay 17, 2017
  2. Jeff KingMay 17, 2017
  3. ref-filter: resolve HEAD when parsing %(HEAD) atomJeff King, May 19, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.