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

Re: [PATCH] describe: limit default ref iteration to tags

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2026, 12:36 UTC
Message-ID
<xmqqecihyzse.fsf@gitster.g>
In-Reply-To
<20260607-describe-tag-ref-scope-v1-1-653d232b86b5@gmail.com>
Tamir Duberstein <tamird@gmail.com> writes:
[jc: Removing Shawn from CC who passed away quite a while ago, RIP].
Show 15 quoted lines
> Unless --all is given, get_name() rejects every ref outside refs/tags/.
> The rejection happens only after the ref backend has enumerated the ref,
> so repositories with many other refs spend most of a simple describe
> invocation visiting refs which cannot affect its result.
> ...
> Both revisions were built with -O3, -mcpu=native, and ThinLTO using
> Apple clang 21.0.0 on macOS 26.5. The machine was a MacBook Pro
> (Mac16,6) with a 16-core Apple M4 Max (12 performance and four
> efficiency cores) and 128 GB RAM.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
>  builtin/describe.c       |  3 +++
>  t/perf/p6100-describe.sh | 20 ++++++++++++++++++++
>  2 files changed, 23 insertions(+)

Interesting. How would this relate to and work well with <20260601233727.43558-1-jacob.e.keller@intel.com>?

Show 27 quoted lines
> +test_lazy_prereq PERF_REFFILES '
> +	test "$(git rev-parse --show-ref-format)" = files
> +'
> +
> +ref_count=10000
> +
>  # clear out old tags and give us a known state
>  test_expect_success 'set up tags' '
>  	git for-each-ref --format="delete %(refname)" refs/tags >to-delete &&
> @@ -27,4 +33,18 @@ test_perf 'describe HEAD with one tag' '
>  	git describe --match=new HEAD
>  '
>  
> +test_expect_success PERF_REFFILES 'set up many unrelated refs' '
> +	git tag -m tip tip HEAD &&
> +	for i in $(test_seq $ref_count)
> +	do
> +		printf "create refs/heads/describe-perf/%05d HEAD\n" $i ||
> +		return 1
> +	done >instructions &&
> +	git update-ref --stdin <instructions
> +'
> +
> +test_perf 'describe exact tag with many loose refs' --prereq PERF_REFFILES '
> +	git describe --exact-match HEAD
> +'
> +

Is there a strong reason to guard this new test behind `PERF_REFFILES`?

Even though the penalty of enumerating 10,000 unrelated loose references may be most pronounced in the `files` backend, skipping unnecessary reference enumeration is an architectural win for other backends (like `reftable` or a fully packed repository) as well.

If we drop `PERF_REFFILES` and retitle the test to "describe exact tag with many unrelated refs", we could run it unconditionally to benchmark the improvement across all storage formats.

Previous: Tamir DubersteinNext: Tamir Duberstein
Message 4 of 5 in “describe: limit default ref iteration to tags”
  1. describe: limit default ref iteration to tagsTamir Duberstein, Jun 7, 2026
  2. Patrick SteinhardtJun 8, 2026
  3. Tamir DubersteinJun 8, 2026
  4. Junio C HamanoJun 8, 2026
  5. Tamir DubersteinJun 8, 2026

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.