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

Why is --graph --max-count=n so much slower than --graph HEAD~n..?

From
MHMitchel Humpherys <mitch.special@gmail.com>
Date
May 20, 2014, 22:17 UTC
Message-ID
<vnkwd2f8ayea.fsf@mitchelh-linux.qualcomm.com>

I've noticed that --max-count doesn't seem to speed up `git log --graph' computation time. Here are some numbers using the linux kernel repository:

    | command                          | time* |
    |----------------------------------+-------|
    | git log --graph --max-count=5000 | 4.11s |
    | git log --graph --max-count=1000 | 4.05s |
    | git log --graph --max-count=500  | 3.95s |
    | git log --graph --max-count=50   | 3.95s |
    | git log --graph --max-count=10   | 3.97s |
    | git log --graph --max-count=1    | 3.96s |

However, specifying a manual revision range results in a much more dramatic speedup as `n' decreases:

    | command                          | time* |
    |----------------------------------+-------|
    | git log --graph HEAD~5000..      | 6.69s |
    | git log --graph HEAD~1000..      | 1.89s |
    | git log --graph HEAD~500..       | 0.03s |
    | git log --graph HEAD~50..        | 0.02s |
    | git log --graph HEAD~10..        | 0.02s |
    | git log --graph HEAD~1..         | 0.00s |
* All times are "steady state" measurements after warming up the disk
  cache by running the command a few times.

I see that the manual revision range doesn't seem to go back as far in history when I diff the output of the two commands. However, if I add `--max-count=50' to the `HEAD~50..' command I get the exact same commits but with fewer "dangling" lines at the bottom of the graph in the `HEAD~50..' approach.

Anyone care to provide any insight about what's going on here? Is this expected behavior? Is there any low-hanging fruit for optimizing --max-count --graph?

-- 
Mitch
Next: Junio C Hamano
Message 1 of 4 in “Why is --graph --max-count=n so much slower than --graph HEAD~n..?”
  1. Mitchel HumpherysMay 20, 2014
  2. Junio C HamanoMay 20, 2014
  3. Mitchel HumpherysMay 21, 2014
  4. Junio C HamanoMay 21, 2014

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.