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

Re: [BUG?] Major performance issue with some commands on our repo's master branch

From
Kyle Meyer <kyle@kyleam.com>
Date
Jun 9, 2022, 01:27 UTC
Message-ID
<87sfoe7hio.fsf@kyleam.com>
In-Reply-To
<YqEyh5opAaJxph2+@coredump.intra.peff.net>
Jeff King writes:
Show 15 quoted lines
> I suspect the issue may be quite subtle. Even you asked for
> "--no-patch", the underlying diff may still be used for other things.
> For example, simplifying away TREESAME commits. I.e., ones which did not
> change anything from their parents after applying path restrictions,
> diff-filters, etc. There may be other cases, too (e.g., --follow).
>
> I think the code could be written to realize that none of those features
> are in use, and disable the diff entirely in favor of checking whether
> the two trees has the same object id. That would yield _mostly_ the same
> behavior, though there are probably corner cases (e.g., a tree with an
> odd mode entry, say, may get parsed so as to produce an empty diff, even
> though it's not byte for byte identical). That may be an acceptable
> tradeoff. But I think the code would be a bit brittle (it needs to know
> about all the cases where a diff might matter, and we may add more
> later).

Do you think it'd be safe to make --no-patch imply --diff-merges=off, as Tao suggested elsewhere in this thread?

  https://lore.kernel.org/git/CAPMMpog-7eDOrgSU9GjV4G9rk5RkL-PJhaUAO3_0p2YxfRf=LA@mail.gmail.com

If so, it seems like that'd be a good way to get speedups for some merge commits. For example, here are hyperfine timings for the current tip of git.git's master branch:

  Benchmark #1: git show --no-patch --format=%h 1e59178e3f
    Time (mean ± σ):      47.8 ms ±   1.5 ms    [User: 43.2 ms, System: 4.6 ms]
    Range (min … max):    46.8 ms …  54.4 ms    59 runs
   
    Warning: Statistical outliers were detected. Consider re-running
    this benchmark on a quiet PC without any interferences from other
    programs. It might help to use the '--warmup' or '--prepare'
    options.
   
  Benchmark #2: git show --no-patch --diff-merges=off --format=%h 1e59178e3f
    Time (mean ± σ):       3.2 ms ±   0.2 ms    [User: 2.5 ms, System: 0.8 ms]
    Range (min … max):     2.9 ms …   6.8 ms    688 runs
   
    Warning: Command took less than 5 ms to complete. Results might be
    inaccurate.
    
    Warning: Statistical outliers were detected. Consider [...]
    options.
   
  Benchmark #3: git log --no-walk --format=%h 1e59178e3f
    Time (mean ± σ):       3.2 ms ±   0.1 ms    [User: 2.4 ms, System: 0.8 ms]
    Range (min … max):     2.9 ms …   4.2 ms    697 runs
   
    Warning: Command took less than 5 ms to complete. Results might [...]
    
    Warning: Statistical outliers were detected. Consider [...]
    
   
  Summary
    'git log --no-walk --format=%h 1e59178e3f' ran
      1.01 ± 0.08 times faster than 'git show --no-patch --diff-merges=off --format=%h 1e59178e3f'
     14.98 ± 0.79 times faster than 'git show --no-patch --format=%h 1e59178e3f'
Previous: Jeff KingNext: Jeff King
Message 6 of 12 in “[BUG?] Major performance issue with some commands on our repo's master branch”
  1. Tassilo HornJun 4, 2022
  2. Tao KlerksJun 4, 2022
  3. Tassilo HornJun 5, 2022
  4. Tao KlerksJun 6, 2022
  5. Jeff KingJun 8, 2022
  6. Kyle MeyerJun 9, 2022
  7. Jeff KingJun 9, 2022
  8. Junio C HamanoJun 9, 2022
  9. Jeff KingJun 9, 2022
  10. Junio C HamanoJun 9, 2022
  11. Tassilo HornJun 9, 2022
  12. Jeff KingJun 9, 2022

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.