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

Re: [PATCH v5 01/11] commit-graph: fix regression when computing Bloom filters

From
Abhishek Kumar <abhishekkumar8222@gmail.com>
Date
Jan 8, 2021, 05:51 UTC
Message-ID
<X/fy6vWfCCVuApTE@Abhishek-Arch>
In-Reply-To
<20210105094535.GN8396@szeder.dev>
On Tue, Jan 05, 2021 at 10:45:35AM +0100, SZEDER Gábor wrote:
Show 46 quoted lines
> On Mon, Dec 28, 2020 at 11:15:58AM +0000, Abhishek Kumar via GitGitGadget wrote:
> > Before computing Bloom fitlers, the commit-graph machinery uses
> > commit_gen_cmp to sort commits by generation order for improved diff
> > performance. 3d11275505 (commit-graph: examine commits by generation
> > number, 2020-03-30) claims that this sort can reduce the time spent to
> > compute Bloom filters by nearly half.
> 
> That's true, though there are repositories where it has basically no
> effect.  Alas we can't directly test it, because in 3d11275505 there
> is no '--changed-paths' option yet... one has to revert 3d11275505 on
> top of d38e07b8c4 (commit-graph: add --changed-paths option to write
> subcommand, 2020-04-06) to make any runtime comparisons ('git
> commit-graph write --reachable --changed-paths', best of five):
> 
>                    Sorting by
>                pack    | generation
>              position  |
>     -------------------+------------
>     gcc      114.821s  |    38.963s 
>     git        8.896s  |     5.620s
>     linux    209.984s  |   104.900s
>     webkit    35.193s  |    35.482s
> 
> Note the almost 3x speedup in the gcc repository, and the basically
> negligible slowdown in the webkit repo.
> 
> > But since c49c82aa4c (commit: move members graph_pos, generation to a
> > slab, 2020-06-17), this optimization is broken, since asking for a
> > 'commit_graph_generation()' directly returns GENERATION_NUMBER_INFINITY
> > while writing.
> 
> I wouldn't say that c49c82aa4c broke this optimisation, because:
> 
> did not break that optimization.  Though, sadly, it's not
> mentioned in 3d11275505's commit message, when commit_gen_cmp()
> compares two commits with identical generation numbers, then it
> doesn't leave them unsorted, but falls back to use their committer
> date as a tie-braker.  This means that after c49c82aa4c the commits
> are sorted by committer date, which appears to be so good a heuristic
> for Bloom filter computation that there is barely any slowdown
> compared to sorting by generation numbers:
> 
> > Not all hope is lost, though: 'commit_graph_generation()' falls back to
> 
> You mean commit_gen_cmp() here.
> 
Yes, fixed.
Show 61 quoted lines
> > comparing commits by their date when they have equal generation number,
> > and so since c49c82aa4c is purely a date comparision function. This
> > heuristic is good enough that we don't seem to loose appreciable
> > performance while computing Bloom filters.
> 
> Indeed, c49c82aa4c barely caused any runtime difference in the
> repositories I usually use to test modified path Bloom filter
> performance:
> 
>                  c49c82aa4c^  c49c82aa4c
>   ---------------------------------------------
>   android-base     43.057s     43.091s   0.07%
>   cmssw            21.781s     21.856s   0.34%
>   cpython           9.626s      9.724s   1.01%
>   elasticsearch    18.049s     18.224s   0.96%
>   gcc              40.312s     40.255s  -0.14%
>   gecko-dev       104.515s    104.740s   0.21%
>   git               5.559s      5.570s   0.19%
>   glibc             4.455s      4.468s   0.29%
>   go                4.009s      4.016s   0.17%
>   homebrew-cask    30.759s     30.523s  -0.76%
>   homebrew-core    57.122s     56.553s  -0.99%
>   jdk              18.297s     18.364s   0.36%
>   linux           104.499s    105.302s   0.76%
>   llvm-project     34.074s     34.446s   1.09%
>   rails             6.472s      6.486s   0.21%
>   rust             14.943s     14.947s   0.02%
>   tensorflow       13.362s     13.477s   0.86%
>   webkit           34.583s     34.601s   0.05%
> 
> > Applying this patch (compared
> > with v2.29.1) speeds up computing Bloom filters by around ~4
> > seconds.
> 
> Without a baseline and knowing which repo, this "~4 seconds" is
> meaningless.
> 
> Here are my results comparing this fix to v2.30.0, best of five:
> 
>                               v2.30.0 +
>                    v2.30.0    this fix
>   ---------------------------------------------
>   android-base     42.786s     42.933s   0.34%
>   cmssw            20.229s     20.160s  -0.34%
>   cpython           9.616s      9.647s   0.32%
>   elasticsearch    16.859s     16.936s   0.45%
>   gcc              38.909s     36.889s  -5.19%
>   gecko-dev        99.417s     98.558s  -0.86%
>   git               5.620s      5.509s  -1.97%
>   glibc             4.307s      4.301s  -0.13%
>   go                3.971s      3.938s  -0.83%
>   homebrew-cask    31.262s     30.283s  -3.13%
>   homebrew-core    57.842s     55.663s  -3.76%
>   jdk              12.557s     12.251s  -2.43%
>   linux            94.335s     94.760s   0.45%
>   llvm-project     34.432s     33.988s  -1.28%
>   rails             6.481s      6.454s  -0.41%
>   rust             14.772s     14.601s  -1.15%
>   tensorflow       11.759s     11.711s  -0.40%
>   webkit           33.917s     33.759s  -0.46%
>
Thank you for the detailed performance benchmarking.
Show 29 quoted lines
> 
> > So, avoid the useless 'commit_graph_generation()' while writing by
> > instead accessing the slab directly. This returns the newly-computed
> > generation numbers, and allows us to avoid the heuristic by directly
> > comparing generation numbers.
> > 
> > Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
> > ---
> >  commit-graph.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/commit-graph.c b/commit-graph.c
> > index 06f8dc1d896..caf823295f4 100644
> > --- a/commit-graph.c
> > +++ b/commit-graph.c
> > @@ -144,8 +144,8 @@ static int commit_gen_cmp(const void *va, const void *vb)
> >  	const struct commit *a = *(const struct commit **)va;
> >  	const struct commit *b = *(const struct commit **)vb;
> >  
> > -	uint32_t generation_a = commit_graph_generation(a);
> > -	uint32_t generation_b = commit_graph_generation(b);
> > +	uint32_t generation_a = commit_graph_data_at(a)->generation;
> > +	uint32_t generation_b = commit_graph_data_at(b)->generation;
> >  	/* lower generation commits first */
> >  	if (generation_a < generation_b)
> >  		return -1;
> > -- 
> > gitgitgadget
> > 
Thanks
- Abhishek
Previous: Abhishek KumarNext: Abhishek Kumar
Message 173 of 211 in “[GSoC] Implement Corrected Commit Date”
  1. 0/6 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Jul 28, 2020
  2. 1/6 commit-graph: fix regression when computing bloom filterAbhishek Kumar via GitGitGadget, Jul 28, 2020
  3. 2/6 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Jul 28, 2020
  4. 3/6 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Jul 28, 2020
  5. 4/6 commit-graph: consolidate compare_commits_by_genAbhishek Kumar via GitGitGadget, Jul 28, 2020
  6. 5/6 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Jul 28, 2020
  7. 6/6 commit-graph: implement corrected commit date offsetAbhishek Kumar via GitGitGadget, Jul 28, 2020
  8. Derrick StoleeJul 28, 2020
  9. Derrick StoleeJul 28, 2020
  10. Taylor BlauJul 28, 2020
  11. René ScharfeJul 28, 2020
  12. Taylor BlauJul 28, 2020
  13. Taylor BlauJul 28, 2020
  14. Derrick StoleeJul 28, 2020
  15. Derrick StoleeJul 28, 2020
  16. Taylor BlauJul 28, 2020
  17. Taylor BlauJul 28, 2020
  18. Taylor BlauJul 28, 2020
  19. Taylor BlauJul 28, 2020
  20. Derrick StoleeJul 28, 2020
  21. Abhishek KumarJul 30, 2020
  22. Abhishek KumarJul 30, 2020
  23. Abhishek KumarJul 30, 2020
  24. Abhishek KumarJul 30, 2020
  25. Abhishek KumarJul 30, 2020
  26. Jakub NarębskiAug 4, 2020
  27. Taylor BlauAug 4, 2020
  28. Jakub NarębskiAug 4, 2020
  29. Jakub NarębskiAug 4, 2020
  30. Jakub NarębskiAug 5, 2020
  31. 01/10 commit-graph: fix regression when computing bloom filterAbhishek Kumar via GitGitGadget, Aug 9, 2020
  32. 03/10 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Aug 9, 2020
  33. 02/10 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Aug 9, 2020
  34. 00/10 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Aug 9, 2020
  35. 08/10 commit-graph: handle mixed generation commit chainsAbhishek Kumar via GitGitGadget, Aug 9, 2020
  36. 09/10 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Aug 9, 2020
  37. 07/10 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Aug 9, 2020
  38. 06/10 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Aug 9, 2020
  39. 10/10 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Aug 9, 2020
  40. 04/10 commit-graph: consolidate compare_commits_by_genAbhishek Kumar via GitGitGadget, Aug 9, 2020
  41. 05/10 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Aug 9, 2020
  42. Derrick StoleeAug 10, 2020
  43. Derrick StoleeAug 10, 2020
  44. Derrick StoleeAug 10, 2020
  45. Derrick StoleeAug 10, 2020
  46. Abhishek KumarAug 11, 2020
  47. Abhishek KumarAug 11, 2020
  48. Derrick StoleeAug 11, 2020
  49. Derrick StoleeAug 11, 2020
  50. Taylor BlauAug 11, 2020
  51. Abhishek KumarAug 14, 2020
  52. Derrick StoleeAug 14, 2020
  53. 01/11 commit-graph: fix regression when computing bloom filterAbhishek Kumar via GitGitGadget, Aug 15, 2020
  54. 04/11 commit-graph: consolidate compare_commits_by_genAbhishek Kumar via GitGitGadget, Aug 15, 2020
  55. 11/11 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Aug 15, 2020
  56. 05/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Aug 15, 2020
  57. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Aug 15, 2020
  58. 10/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Aug 15, 2020
  59. 09/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Aug 15, 2020
  60. 08/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Aug 15, 2020
  61. 06/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Aug 15, 2020
  62. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Aug 15, 2020
  63. 07/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Aug 15, 2020
  64. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Aug 15, 2020
  65. Jakub NarębskiAug 17, 2020
  66. Taylor BlauAug 17, 2020
  67. Jakub NarębskiAug 17, 2020
  68. Derrick StoleeAug 17, 2020
  69. Jakub NarębskiAug 17, 2020
  70. Abhishek KumarAug 18, 2020
  71. Jakub NarębskiAug 18, 2020
  72. Jakub NarębskiAug 19, 2020
  73. Abhishek KumarAug 21, 2020
  74. Jakub NarębskiAug 21, 2020
  75. Jakub NarębskiAug 21, 2020
  76. Jakub NarębskiAug 21, 2020
  77. Jakub NarębskiAug 22, 2020
  78. Jakub NarębskiAug 22, 2020
  79. Jakub NarębskiAug 22, 2020
  80. Jakub NarębskiAug 22, 2020
  81. Jakub NarębskiAug 22, 2020
  82. Jakub NarębskiAug 23, 2020
  83. Abhishek KumarAug 24, 2020
  84. Abhishek KumarAug 25, 2020
  85. Abhishek KumarAug 25, 2020
  86. Abhishek KumarAug 25, 2020
  87. Jakub NarębskiAug 25, 2020
  88. Jakub NarębskiAug 25, 2020
  89. Jakub NarębskiAug 25, 2020
  90. Jakub NarębskiAug 25, 2020
  91. Jakub NarębskiAug 25, 2020
  92. Abhishek KumarAug 26, 2020
  93. Jakub NarębskiAug 26, 2020
  94. Abhishek KumarAug 27, 2020
  95. Jakub NarębskiAug 27, 2020
  96. Derrick StoleeAug 27, 2020
  97. Abhishek KumarSep 1, 2020
  98. Abhishek KumarSep 1, 2020
  99. Abhishek KumarSep 1, 2020
  100. Abhishek KumarSep 1, 2020
  101. Abhishek KumarSep 1, 2020
  102. Abhishek KumarSep 1, 2020
  103. Jakub NarębskiSep 3, 2020
  104. Jakub NarębskiSep 3, 2020
  105. Jakub NarębskiSep 3, 2020
  106. Abhishek KumarSep 5, 2020
  107. Jakub NarębskiSep 13, 2020
  108. Jakub NarębskiSep 28, 2020
  109. Abhishek KumarOct 5, 2020
  110. 02/10 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Oct 7, 2020
  111. 01/10 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Oct 7, 2020
  112. 00/10 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Oct 7, 2020
  113. 03/10 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Oct 7, 2020
  114. 05/10 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Oct 7, 2020
  115. 04/10 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Oct 7, 2020
  116. 10/10 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Oct 7, 2020
  117. 09/10 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Oct 7, 2020
  118. 07/10 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Oct 7, 2020
  119. 08/10 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Oct 7, 2020
  120. 06/10 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Oct 7, 2020
  121. Jakub NarębskiOct 24, 2020
  122. Jakub NarębskiOct 24, 2020
  123. Jakub NarębskiOct 25, 2020
  124. Jakub NarębskiOct 25, 2020
  125. Taylor BlauOct 25, 2020
  126. Jakub NarębskiOct 25, 2020
  127. Abhishek KumarOct 27, 2020
  128. Jakub NarębskiOct 27, 2020
  129. Jakub NarębskiOct 30, 2020
  130. Jakub NarębskiNov 1, 2020
  131. Abhishek KumarNov 3, 2020
  132. Abhishek KumarNov 3, 2020
  133. Abhishek KumarNov 3, 2020
  134. Jakub NarębskiNov 3, 2020
  135. Junio C HamanoNov 3, 2020
  136. Jakub NarębskiNov 4, 2020
  137. Jakub NarębskiNov 4, 2020
  138. Jakub NarębskiNov 4, 2020
  139. Philip OakleyNov 5, 2020
  140. Junio C HamanoNov 5, 2020
  141. Abhishek KumarNov 6, 2020
  142. Jakub NarębskiNov 6, 2020
  143. Extending and updating gitglossary (was: Re: [PATCH v4 06/10] commit-graph: implement corrected commit date)Jakub Narębski, Nov 6, 2020
  144. Junio C HamanoNov 6, 2020
  145. Philip OakleyNov 8, 2020
  146. Jakub NarębskiNov 10, 2020
  147. Philip OakleyNov 10, 2020
  148. Jakub NarębskiNov 10, 2020
  149. Abhishek KumarNov 12, 2020
  150. Jakub NarębskiNov 13, 2020
  151. Abhishek KumarNov 20, 2020
  152. Abhishek KumarNov 21, 2020
  153. Abhishek KumarNov 22, 2020
  154. 01/11 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Dec 28, 2020
  155. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Dec 28, 2020
  156. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Dec 28, 2020
  157. 04/11 t6600-test-reach: generalize *_three_modesAbhishek Kumar via GitGitGadget, Dec 28, 2020
  158. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Dec 28, 2020
  159. 05/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Dec 28, 2020
  160. 06/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Dec 28, 2020
  161. 10/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Dec 28, 2020
  162. 07/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Dec 28, 2020
  163. 11/11 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Dec 28, 2020
  164. 08/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Dec 28, 2020
  165. 09/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Dec 28, 2020
  166. Derrick StoleeDec 30, 2020
  167. Derrick StoleeDec 30, 2020
  168. Derrick StoleeDec 30, 2020
  169. Derrick StoleeDec 30, 2020
  170. SZEDER GáborJan 5, 2021
  171. SZEDER GáborJan 5, 2021
  172. Abhishek KumarJan 8, 2021
  173. Abhishek KumarJan 8, 2021
  174. Abhishek KumarJan 10, 2021
  175. Abhishek KumarJan 10, 2021
  176. Abhishek KumarJan 10, 2021
  177. Derrick StoleeJan 11, 2021
  178. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Jan 16, 2021
  179. 01/11 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Jan 16, 2021
  180. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Jan 16, 2021
  181. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Jan 16, 2021
  182. 04/11 t6600-test-reach: generalize *_three_modesAbhishek Kumar via GitGitGadget, Jan 16, 2021
  183. 07/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Jan 16, 2021
  184. 06/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Jan 16, 2021
  185. 11/11 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Jan 16, 2021
  186. 05/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Jan 16, 2021
  187. 08/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Jan 16, 2021
  188. 10/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Jan 16, 2021
  189. 09/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Jan 16, 2021
  190. Derrick StoleeJan 18, 2021
  191. Taylor BlauJan 18, 2021
  192. Junio C HamanoJan 19, 2021
  193. Abhishek KumarJan 23, 2021
  194. Abhishek KumarJan 23, 2021
  195. SZEDER GáborJan 27, 2021
  196. Abhishek KumarJan 30, 2021
  197. Taylor BlauJan 31, 2021
  198. 01/11 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Feb 1, 2021
  199. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Feb 1, 2021
  200. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Feb 1, 2021
  201. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Feb 1, 2021
  202. 04/11 t6600-test-reach: generalize *_three_modesAbhishek Kumar via GitGitGadget, Feb 1, 2021
  203. 05/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Feb 1, 2021
  204. 06/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Feb 1, 2021
  205. 08/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Feb 1, 2021
  206. 10/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Feb 1, 2021
  207. 09/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Feb 1, 2021
  208. 07/11 commit-graph: document generation number v2Abhishek Kumar via GitGitGadget, Feb 1, 2021
  209. 11/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Feb 1, 2021
  210. Derrick StoleeFeb 1, 2021
  211. Junio C HamanoFeb 1, 2021

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.