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

Re: [PATCH 0/3] pack-bitmap: boundary-based bitmap traversal

From
Derrick Stolee <derrickstolee@github.com>
Date
Apr 25, 2023, 18:06 UTC
Message-ID
<f25c6234-83c0-fa49-85f5-9005e312b8a3@github.com>
In-Reply-To
<cover.1682380788.git.me@ttaylorr.com>
On 4/24/2023 8:00 PM, Taylor Blau wrote:
Show 23 quoted lines
> Here is a short (but dense) series that I worked on towards the end of
> 2021 with Peff.
> 
> Its goal is to improve the bitmap traversal we implement in
> prepare_bitmap_walk(). Specifically, it avoids building up a complete
> bitmap of the "haves" side, and instead uses a combination of (a)
> UNINTERESTING commits between the tips and boundary, and (b) the
> boundary itself.
> 
> The gory details are laid out in 3/3, but the high-level overview of the
> new algorithm to compute the set of objects between "haves" and "wants"
> using bitmaps is:
> 
>   1. Build a (partial) bitmap of the haves side by first OR-ing any
>      bitmap(s) that already exist for UNINTERESTING commits between the
>      haves and the boundary.
> 
>   2. For each commit along the boundary, add it as a fill-in traversal
>      tip (where the traversal terminates once an existing bitmap is
>      found), and perform fill-in traversal.
> 
>   3. Build up a complete bitmap of the wants side as usual, stopping any
>      time we intersect the (partial) haves side.
In other words: this generates something closer to the object set in the
non-bitmapped object walk. The only difference is that the new bitmapped
algorithm will see objects that were re-introduced across the boundary
(say, a blob was reverted to its older mode).
 
Show 37 quoted lines
> This improves many cases where using bitmaps was significantly *slower*
> than regular, non-bitmap traversal. In some instances, using bitmaps is
> still slower than the non-bitmap case, but it is a substantial
> improvement over the classic bitmap walk.> 
>     $ ours="$(git branch --show-current)"
>       argv="--count --objects $ours --not --exclude=$ours --branches"
>       hyperfine \
>         -n 'no bitmaps' "git.compile rev-list $argv" \
>         -n 'existing bitmap traversal' "git rev-list --use-bitmap-index $argv" \
>         -n 'this commit' "git.compile rev-list --use-bitmap-index $argv"
>     Benchmark 1: no bitmaps
>       Time (mean ± σ):      15.1 ms ±   4.1 ms    [User: 8.1 ms, System: 6.9 ms]
>       Range (min … max):     7.4 ms …  21.8 ms    131 runs
> 
>     Benchmark 2: existing bitmap traversal
>       Time (mean ± σ):      82.6 ms ±   9.2 ms    [User: 63.6 ms, System: 19.0 ms]
>       Range (min … max):    73.8 ms … 105.4 ms    28 runs
> 
>     Benchmark 3: this commit
>       Time (mean ± σ):      19.8 ms ±   3.1 ms    [User: 13.0 ms, System: 6.8 ms]
>       Range (min … max):    17.7 ms …  38.6 ms    158 runs
> 
>     Summary
>       'no bitmaps' ran
>         1.31 ± 0.41 times faster than 'this commit'
>         5.49 ± 1.62 times faster than 'existing bitmap traversal'
> 
> In a large repository on GitHub.com, the timings to compute the objects
> unique to "master", as in:
> 
>     $ git rev-list --count --objects master --not --exclude=master --branches
> 
> improve as follows:
> 
>   - 1.012 sec (without bitmaps)
>   - 29.571 sec (with the existing bitmap walk)
>   - 2.279 sec (with these patches)

For my curiosity, and since you already have a test environment set up, could you redo the "without bitmaps" case with pack.useSparse true and false? When the option was created and defaulted to true, we never really explored comparing it to the bitmap case. In fact, I assumed the bitmap case was faster in important cases like this (where there is a substantial difference in object counts), but your data is surprising me that the sparse algorithm is outperforming bitmaps, even with this new algorithm.

The main question I'd like to ask is: is pack.useSparse contributing
in an important way to the performance here?
 
I'll go poking into the patches now.

Thanks, -Stolee

Previous: Taylor BlauNext: Taylor Blau
Message 25 of 51 in “pack-bitmap: boundary-based bitmap traversal”
  1. 0/3 pack-bitmap: boundary-based bitmap traversalTaylor Blau, Apr 25, 2023
  2. 1/3 revision: support tracking uninteresting commitsTaylor Blau, Apr 25, 2023
  3. Derrick StoleeApr 25, 2023
  4. Taylor BlauMay 3, 2023
  5. Derrick StoleeMay 4, 2023
  6. Taylor BlauMay 3, 2023
  7. Derrick StoleeMay 4, 2023
  8. Taylor BlauMay 5, 2023
  9. Junio C HamanoApr 25, 2023
  10. Taylor BlauApr 25, 2023
  11. 2/3 pack-bitmap.c: extract `fill_in_bitmap()`Taylor Blau, Apr 25, 2023
  12. Junio C HamanoApr 25, 2023
  13. Taylor BlauApr 25, 2023
  14. 3/3 pack-bitmap.c: use commit boundary during bitmap traversalTaylor Blau, Apr 25, 2023
  15. Junio C HamanoApr 25, 2023
  16. Felipe ContrerasMay 2, 2023
  17. Taylor BlauMay 3, 2023
  18. Junio C HamanoMay 3, 2023
  19. Derrick StoleeApr 25, 2023
  20. Junio C HamanoApr 25, 2023
  21. Derrick StoleeApr 25, 2023
  22. Taylor BlauApr 25, 2023
  23. Derrick StoleeApr 25, 2023
  24. Taylor BlauMay 3, 2023
  25. Derrick StoleeApr 25, 2023
  26. Taylor BlauApr 25, 2023
  27. Derrick StoleeApr 25, 2023
  28. Junio C HamanoMay 1, 2023
  29. Taylor BlauMay 2, 2023
  30. 0/2 pack-bitmap: boundary-based bitmap traversalTaylor Blau, May 5, 2023
  31. 1/2 pack-bitmap.c: extract `fill_in_bitmap()`Taylor Blau, May 5, 2023
  32. 2/2 pack-bitmap.c: use commit boundary during bitmap traversalTaylor Blau, May 5, 2023
  33. Derrick StoleeMay 5, 2023
  34. Taylor BlauMay 5, 2023
  35. Junio C HamanoMay 5, 2023
  36. Derrick StoleeMay 5, 2023
  37. Taylor BlauMay 5, 2023
  38. Derrick StoleeMay 5, 2023
  39. 0/3 pack-bitmap: boundary-based bitmap traversalTaylor Blau, May 8, 2023
  40. 1/3 object: add object_array initializer helper functionTaylor Blau, May 8, 2023
  41. 2/3 pack-bitmap.c: extract `fill_in_bitmap()`Taylor Blau, May 8, 2023
  42. 3/3 pack-bitmap.c: use commit boundary during bitmap traversalTaylor Blau, May 8, 2023
  43. Derrick StoleeMay 8, 2023
  44. Taylor BlauMay 8, 2023
  45. Junio C HamanoMay 10, 2023
  46. Taylor BlauMay 10, 2023
  47. Derrick StoleeMay 11, 2023
  48. 0/3 pack-bitmap: boundary-based bitmap traversalTaylor Blau, Jun 8, 2023
  49. 1/3 object: add object_array initializer helper functionTaylor Blau, Jun 8, 2023
  50. 2/3 pack-bitmap.c: extract `fill_in_bitmap()`Taylor Blau, Jun 8, 2023
  51. 3/3 pack-bitmap.c: use commit boundary during bitmap traversalTaylor Blau, Jun 8, 2023

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.