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

Re: Discussion on git-refs list Implementation and Possible Approaches

From
Yuting Zheng <05zyt30@gmail.com>
Date
Apr 4, 2025, 15:25 UTC
Message-ID
<CAMvj1+paWq5LV1imUz0HcQh1eoGvdfkYi0B5FPV33Xt-OUe1Dg@mail.gmail.com>
In-Reply-To
<CAOLa=ZTTPuNyaE5Z-bfkQougmKQSrRZZwLaxJUL7mdmj8uHoFw@mail.gmail.com>
Thanks for your reply!
> I would categorize '--sort' into a third subcategory. Filtering refers
> to possible change in the size of the sample set. While sorting is more
> of a presentation utility.
>

That’s a good idea, it makes my plan more clear. I will separate the “--filter” options into “--filter” and “--sort” so that users can clearly distinguish them.

> This is indeed a special case which applies to both sorting and
> filtering.
Understood!
Show 8 quoted lines
>
> You mean complex from the user perspective of having too many options or
> from the implementation perspective.
>
> I think from the UX perspective, it is a good time to rethink usage and
> need for the options you mentioned above. , for e.g. with '--format', do
> we need to have '--tcl', `--shell` and `--perl`?
>

I think it’s important to discuss all available options, and I will submit another email for further discussion.

Show 37 quoted lines
> > 2. The performance could be worse than `git-for-each-ref`.
> >
>
> Why would it be worse? The performance difference between
> `git-for-each-ref(1)` and `git-show-ref(1)` stem from the formats they
> use by default.
>
> $ hyperfine --shell=none --warmup=3 "git for-each-ref" "git show-ref"
> Benchmark 1: git for-each-ref
>   Time (mean ± σ):       4.0 ms ±   0.6 ms    [User: 1.9 ms, System: 1.9 ms]
>   Range (min … max):     3.0 ms …   5.7 ms    680 runs
>
> Benchmark 2: git show-ref
>   Time (mean ± σ):       2.9 ms ±   0.4 ms    [User: 1.2 ms, System: 1.5 ms]
>   Range (min … max):     2.0 ms …   4.3 ms    909 runs
>
> Summary
>   git show-ref ran
>     1.38 ± 0.28 times faster than git for-each-ref
>
> What I found interesting was that changing the format for
> 'git-for-each-ref(1)' gives it a boost:
>
> $ hyperfine --shell=none --warmup=3 'git for-each-ref
> --format="%(objectname) %(refname)"' "git show-ref"
> Benchmark 1: git for-each-ref --format="%(objectname) %(refname)"
>   Time (mean ± σ):       2.4 ms ±   0.3 ms    [User: 1.1 ms, System: 1.1 ms]
>   Range (min … max):     1.7 ms …   3.6 ms    1070 runs
>
> Benchmark 2: git show-ref
>   Time (mean ± σ):       2.9 ms ±   0.4 ms    [User: 1.2 ms, System: 1.5 ms]
>   Range (min … max):     2.0 ms …   4.5 ms    833 runs
>
> Summary
>   git for-each-ref --format="%(objectname) %(refname)" ran
>     1.20 ± 0.23 times faster than git show-ref
>

Thank you for the reminder. Once each option is implemented, I will test its performance to ensure that it maintains—or improves upon—the efficiency of the previous version.

Show 13 quoted lines
>
> And what is the expectation that when you want to do both filtering and
> formatting, would the user be expected to do `git refs filter | git refs
> show`? Generally users want to combine both of these options.
>
> Also wasn't the idea to already implement `git-refs show` as a
> standalone which simply shows what value a reference holds (without
> derefence)?
>
> While I would think Approach 1 is the better option here, I'm also
> seeing how it is complex, perhaps a good option to get started would be
> to implement a simpler subcommand as a first case? Perhaps the
> originally discussed `git refs show`?

I agree that implementing `git-refs show` first would provide a solid foundation for other options. I will add these improvements in the next version of the proposal.

Thanks! Zheng Yuting

Previous: Karthik NayakNext: Patrick Steinhardt
Message 12 of 17 in “[GSoC] Proposal Discussion: git-refs Project”
  1. Yuting ZhengMar 23, 2025
  2. Patrick SteinhardtMar 24, 2025
  3. Yuting ZhengMar 27, 2025
  4. shejialuoMar 28, 2025
  5. Yuting ZhengMar 29, 2025
  6. [GSoC] git-refs proposal draftZheng Yuting, Mar 29, 2025
  7. Patrick SteinhardtMar 31, 2025
  8. Yuting ZhengApr 1, 2025
  9. Patrick SteinhardtApr 2, 2025
  10. Discussion on git-refs list Implementation and Possible ApproachesZheng Yuting, Apr 3, 2025
  11. Karthik NayakApr 4, 2025
  12. Yuting ZhengApr 4, 2025
  13. Patrick SteinhardtApr 4, 2025
  14. Yuting ZhengApr 4, 2025
  15. Yuting ZhengApr 4, 2025
  16. [GSoC] git-refs proposal v2Yuting Zheng, Apr 6, 2025
  17. Fwd: Discussion on git-refs list Implementation and Possible ApproachesYuting Zheng, Apr 4, 2025

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.