Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9a85fa8406d6281dfcc3caa1e3d3828a5f73a363
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 08bb69d70f55cb6b44cdc6aefa7bc1d9cf4eb3f3
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Aug 3, 2025

  1. describe: use prio_queue

    Replace the use a list-based priority queue whose order is maintained by
    commit_list_insert_by_date() with a prio_queue.  This avoids quadratic
    worst-case complexity.  And in the somewhat contrived example of
    describing the 4751 commits from v2.41.0 to v2.47.0 in one go (to get a
    sizable chunk of describe work with minimal ref loading overhead) it's
    significantly faster:
    
    Benchmark 1: ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0)
      Time (mean ± σ):      1.558 s ±  0.002 s    [User: 1.492 s, System: 0.051 s]
      Range (min … max):    1.557 s …  1.562 s    10 runs
    
    Benchmark 2: ./git describe $(git rev-list v2.41.0..v2.47.0)
      Time (mean ± σ):      1.209 s ±  0.006 s    [User: 1.143 s, System: 0.051 s]
      Range (min … max):    1.201 s …  1.219 s    10 runs
    
    Summary
      ./git describe $(git rev-list v2.41.0..v2.47.0) ran
        1.29 ± 0.01 times faster than ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0)
    
    Signed-off-by: René Scharfe <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    rscharfe authored and gitster committed Aug 3, 2025
    Configuration menu
    Copy the full SHA
    66e2adb View commit details
    Browse the repository at this point in the history
  2. describe: use prio_queue_replace()

    Optimize the sequence get+put to peek+replace to avoid one unnecessary
    heap rebalance.
    
    Do that by tracking partial get operations in a prio_queue wrapper,
    struct lazy_queue, and using wrapper functions that turn get into peek
    and put into replace as needed.  This is simpler than tracking the
    state explicitly in the calling code.
    
    We get a nice speedup on top of the previous patch's conversion to
    prio_queue:
    
    Benchmark 1: ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0)
      Time (mean ± σ):      1.559 s ±  0.002 s    [User: 1.493 s, System: 0.051 s]
      Range (min … max):    1.556 s …  1.563 s    10 runs
    
    Benchmark 2: ./git_describe_pq describe $(git rev-list v2.41.0..v2.47.0)
      Time (mean ± σ):      1.204 s ±  0.001 s    [User: 1.138 s, System: 0.051 s]
      Range (min … max):    1.202 s …  1.205 s    10 runs
    
    Benchmark 3: ./git describe $(git rev-list v2.41.0..v2.47.0)
      Time (mean ± σ):     850.9 ms ±   1.6 ms    [User: 786.6 ms, System: 49.8 ms]
      Range (min … max):   849.1 ms … 854.1 ms    10 runs
    
    Summary
      ./git describe $(git rev-list v2.41.0..v2.47.0) ran
        1.41 ± 0.00 times faster than ./git_describe_pq describe $(git rev-list v2.41.0..v2.47.0)
        1.83 ± 0.00 times faster than ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0)
    
    Signed-off-by: René Scharfe <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    rscharfe authored and gitster committed Aug 3, 2025
    Configuration menu
    Copy the full SHA
    08bb69d View commit details
    Browse the repository at this point in the history
Loading