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

Re: [PATCH 00/83] libify apply and use lib in am

From
Christian Couder <christian.couder@gmail.com>
Date
Apr 25, 2016, 09:57 UTC
Message-ID
<CAP8UFD05Cpsms8Tf_VmMeemoerfMm0E8fUqL3o0n_9d1hu7VMg@mail.gmail.com>
In-Reply-To
<CACsJy8AAQJhX+b1UUhVxC_vV_4r=XjDSbtDDd5MLkgwKri8dEg@mail.gmail.com>
On Mon, Apr 25, 2016 at 11:02 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 7 quoted lines
> On Sun, Apr 24, 2016 at 8:33 PM, Christian Couder
> <christian.couder@gmail.com> wrote:
>> Sorry if this patch series is a bit long. I can split it into two or
>> more series if it is prefered.
>
> I suspect you deliberately made the series long just to show off how
> good new git-rebase is ;-)
Yeah, and `git am` too :-)
Show 16 quoted lines
>> Performance numbers:
>>
>>   - A few days ago Ævar did a huge many-hundred commit rebase on the
>>     kernel with untracked cache.
>>
>> command: git rebase --onto 1993b17 52bef0c 29dde7c
>>
>> Vanilla "next" without split index:                1m54.953s
>> Vanilla "next" with split index:                   1m22.476s
>> This series on top of "next" without split index:  1m12.034s
>> This series on top of "next" with split index:     0m15.678s
>
> I was a bit puzzled why split-index helped so much. It shouldn't have
> in my opinion unless you paired it with index-helper, to cut down both
> read and write time. So I ran some tests. Long story short, I think we
> can achieve this gain (and a little more) even without split-index.

Yeah, perhaps. For now though Ævar and myself would be happy to just have a config option for split-index :-)

The other performance numbers I mentioned show that now the `git am` part of a 13 commit long rebase is reduced from 58% to 19% of the whole rebase time. So further improvements in speeding up `git am` could only make such a rebase at most 19% faster.

Show 22 quoted lines
> I ran my measurement patch [1] with and without your series used this
> series as rebase material. Without the series, the picture is not so
> surprising. We run git-apply 80+ times, each consists of this sequence
>
> read index
> write index (cache tree updates only)
> read index again
> optionally initialize name hash (when new entries are added, I guess)
> read packed-refs
> write index
>
> With this series, we run a single git-apply which does
>
> read index (and sharedindex too if in split-index mode)
> initialize name hash
> write index 80+ times
>
> This explains why I guessed it wrong: when you write only, not read
> back, of course index-helper is not required. And with split-index you
> only write as many entries as you touch (which is usually a small
> number compared to worktree's size), so writing 80+ times with
> split-index is a lot faster than write 80+ times with whole index.

Yeah, I tried to explain in the cover letter and in the last patch why this series enables split-index to give great results, but I think you are much better at explaining it.

> But why write so many times when nobody reads it? We only need to
> write before git-apply exits,
You mean `git am` here I think.
> either after successfully applying the
> whole series, or after it stops at conflicts, and maybe even at die()
> and SIGINT. Yes if git-apply segfaults,
Here too.
> then the index update is lost,
> but in such a case, it's usually a good idea to restart fresh anyway.
> When you only write index once (or twice) it won't matter if
> split-index is used.

Yeah I agree, but it would need further work, that can be done after this series is merged. And I am not sure if the potential gains on a typical rebase would be worth it.

Thanks, Christian.

Previous: Duy NguyenNext: Duy Nguyen
Message 148 of 156 in “libify apply and use lib in am”
  1. 00/83 libify apply and use lib in amChristian Couder, Apr 24, 2016
  2. 01/83 builtin/apply: make gitdiff_verify_name() return voidChristian Couder, Apr 24, 2016
  3. 02/83 builtin/apply: avoid parameter shadowing 'p_value' globalChristian Couder, Apr 24, 2016
  4. 03/83 builtin/apply: avoid parameter shadowing 'linenr' globalChristian Couder, Apr 24, 2016
  5. Junio C HamanoApr 27, 2016
  6. Christian CouderApr 27, 2016
  7. 04/83 builtin/apply: avoid local variable shadowing 'len' parameterChristian Couder, Apr 24, 2016
  8. 05/83 builtin/apply: extract line_by_line_fuzzy_match() from match_fragment()Christian Couder, Apr 24, 2016
  9. Stefan BellerApr 25, 2016
  10. Christian CouderApr 26, 2016
  11. Junio C HamanoApr 26, 2016
  12. Christian CouderApr 27, 2016
  13. 06/83 builtin/apply: move 'options' variable into cmd_apply()Christian Couder, Apr 24, 2016
  14. 07/83 builtin/apply: introduce 'struct apply_state' to start libifyingChristian Couder, Apr 24, 2016
  15. 08/83 builtin/apply: move 'unidiff_zero' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  16. 09/83 builtin/apply: move 'check' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  17. Stefan BellerApr 25, 2016
  18. Christian CouderApr 26, 2016
  19. Stefan BellerApr 26, 2016
  20. 10/83 builtin/apply: move 'check_index' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  21. Junio C HamanoApr 26, 2016
  22. 11/83 builtin/apply: move 'apply_in_reverse' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  23. 12/83 builtin/apply: move 'apply_with_reject' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  24. 13/83 builtin/apply: move 'apply_verbosely' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  25. 14/83 builtin/apply: move 'update_index' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  26. 15/83 builtin/apply: move 'allow_overlap' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  27. 16/83 builtin/apply: move 'cached' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  28. 17/83 builtin/apply: move 'diffstat' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  29. 18/83 builtin/apply: move 'numstat' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  30. Stefan BellerApr 25, 2016
  31. Christian CouderApr 26, 2016
  32. 19/83 builtin/apply: move 'summary' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  33. 20/83 builtin/apply: move 'threeway' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  34. 21/83 builtin/apply: move 'no-add' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  35. 22/83 builtin/apply: move 'unsafe_paths' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  36. Junio C HamanoApr 26, 2016
  37. Christian CouderApr 27, 2016
  38. Junio C HamanoApr 27, 2016
  39. 23/83 builtin/apply: move 'line_termination' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  40. 24/83 builtin/apply: move 'fake_ancestor' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  41. 25/83 builtin/apply: move 'p_context' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  42. 26/83 builtin/apply: move 'apply' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  43. 27/83 builtin/apply: move 'read_stdin' global into cmd_apply()Christian Couder, Apr 24, 2016
  44. Junio C HamanoApr 26, 2016
  45. Christian CouderApr 27, 2016
  46. 28/83 builtin/apply: move 'patch_input_file' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  47. 29/83 builtin/apply: move 'limit_by_name' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  48. 30/83 builtin/apply: move 'has_include' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  49. 31/83 builtin/apply: move 'p_value' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  50. 32/83 builtin/apply: move 'p_value_known' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  51. 33/83 builtin/apply: move 'root' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  52. Stefan BellerApr 25, 2016
  53. Stefan BellerApr 25, 2016
  54. Christian CouderApr 26, 2016
  55. 34/83 builtin/apply: move 'whitespace_error' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  56. 35/83 builtin/apply: move 'whitespace_option' into 'struct apply_state'Christian Couder, Apr 24, 2016
  57. 36/83 builtin/apply: remove whitespace_option arg from set_default_whitespace_mode()Christian Couder, Apr 24, 2016
  58. 37/83 builtin/apply: move 'squelch_whitespace_errors' into 'struct apply_state'Christian Couder, Apr 24, 2016
  59. 38/83 builtin/apply: move 'applied_after_fixing_ws' into 'struct apply_state'Christian Couder, Apr 24, 2016
  60. 39/83 builtin/apply: move 'ws_error_action' into 'struct apply_state'Christian Couder, Apr 24, 2016
  61. Junio C HamanoApr 26, 2016
  62. Junio C HamanoApr 26, 2016
  63. Christian CouderApr 27, 2016
  64. 40/83 builtin/apply: move 'ws_ignore_action' into 'struct apply_state'Christian Couder, Apr 24, 2016
  65. 41/83 builtin/apply: move 'max_change' and 'max_len' into 'struct apply_state'Christian Couder, Apr 24, 2016
  66. 42/83 builtin/apply: move 'linenr' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  67. 43/83 builtin/apply: move 'fn_table' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  68. 44/83 builtin/apply: move 'symlink_changes' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  69. 45/83 builtin/apply: move 'state' init into init_apply_state()Christian Couder, Apr 24, 2016
  70. Eric SunshineApr 25, 2016
  71. Christian CouderApr 27, 2016
  72. 46/83 builtin/apply: move 'state' check into check_apply_state()Christian Couder, Apr 24, 2016
  73. 47/83 builtin/apply: move applying patches into apply_all_patches()Christian Couder, Apr 24, 2016
  74. Stefan BellerApr 25, 2016
  75. Christian CouderApr 27, 2016
  76. 48/83 builtin/apply: rename 'prefix_' parameter to 'prefix'Christian Couder, Apr 24, 2016
  77. 49/83 builtin/apply: move 'lock_file' global into 'struct apply_state'Christian Couder, Apr 24, 2016
  78. Eric SunshineApr 25, 2016
  79. Junio C HamanoApr 25, 2016
  80. Christian CouderApr 28, 2016
  81. Junio C HamanoApr 28, 2016
  82. Christian CouderApr 30, 2016
  83. 50/83 builtin/apply: get rid of the 'newfd' globalChristian Couder, Apr 24, 2016
  84. 51/83 builtin/apply: make apply_patch() return -1 instead of die()ingChristian Couder, Apr 24, 2016
  85. Eric SunshineApr 26, 2016
  86. Christian CouderApr 30, 2016
  87. 52/83 builtin/apply: read_patch_file() return -1 instead of die()ingChristian Couder, Apr 24, 2016
  88. 53/83 builtin/apply: make find_header() return -1 instead of die()ingChristian Couder, Apr 24, 2016
  89. Duy NguyenApr 25, 2016
  90. Eric SunshineApr 27, 2016
  91. Christian CouderMay 1, 2016
  92. Eric SunshineApr 27, 2016
  93. Christian CouderMay 1, 2016
  94. 54/83 builtin/apply: make parse_chunk() return a negative integer on errorChristian Couder, Apr 24, 2016
  95. Eric SunshineMay 1, 2016
  96. Christian CouderMay 1, 2016
  97. 55/83 builtin/apply: make parse_single_patch() return -1 on errorChristian Couder, Apr 24, 2016
  98. Eric SunshineMay 1, 2016
  99. 56/83 apply: move 'struct apply_state' to apply.hChristian Couder, Apr 24, 2016
  100. 57/83 builtin/apply: libify parse_whitespace_option()Christian Couder, Apr 24, 2016
  101. 58/83 builtin/apply: libify parse_ignorewhitespace_option()Christian Couder, Apr 24, 2016
  102. 59/83 builtin/apply: move init_apply_state() to apply.cChristian Couder, Apr 24, 2016
  103. Eric SunshineMay 1, 2016
  104. Christian CouderMay 1, 2016
  105. 60/83 apply: libify init_apply_state()Christian Couder, Apr 24, 2016
  106. 61/83 builtin/apply: libify check_apply_state()Christian Couder, Apr 24, 2016
  107. Duy NguyenApr 25, 2016
  108. Christian CouderMay 1, 2016
  109. 62/83 builtin/apply: move check_apply_state() to apply.cChristian Couder, Apr 24, 2016
  110. 63/83 builtin/apply: make apply_all_patches() return -1 on errorChristian Couder, Apr 24, 2016
  111. Duy NguyenApr 25, 2016
  112. Christian CouderMay 1, 2016
  113. Eric SunshineMay 1, 2016
  114. Johannes SchindelinMay 2, 2016
  115. Christian CouderMay 3, 2016
  116. 64/83 builtin/apply: make parse_traditional_patch() return -1 on errorChristian Couder, Apr 24, 2016
  117. 65/83 builtin/apply: make gitdiff_verify_name() return -1 on errorChristian Couder, Apr 24, 2016
  118. Duy NguyenApr 25, 2016
  119. Christian CouderMay 1, 2016
  120. 66/83 builtin/apply: change die_on_unsafe_path() to check_unsafe_path()Christian Couder, Apr 24, 2016
  121. 67/83 builtin/apply: make build_fake_ancestor() return -1 on errorChristian Couder, Apr 24, 2016
  122. Eric SunshineMay 2, 2016
  123. Christian CouderMay 3, 2016
  124. 68/83 builtin/apply: make remove_file() return -1 on errorChristian Couder, Apr 24, 2016
  125. 69/83 builtin/apply: make add_conflicted_stages_file() return -1 on errorChristian Couder, Apr 24, 2016
  126. Eric SunshineMay 2, 2016
  127. Christian CouderMay 3, 2016
  128. 70/83 builtin/apply: make add_index_file() return -1 on errorChristian Couder, Apr 24, 2016
  129. 71/83 builtin/apply: make create_file() return -1 on errorChristian Couder, Apr 24, 2016
  130. 72/83 builtin/apply: make write_out_one_result() return -1 on errorChristian Couder, Apr 24, 2016
  131. 73/83 builtin/apply: make write_out_results() return -1 on errorChristian Couder, Apr 24, 2016
  132. Eric SunshineMay 2, 2016
  133. Christian CouderMay 3, 2016
  134. 74/83 builtin/apply: make try_create_file() return -1 on errorChristian Couder, Apr 24, 2016
  135. Eric SunshineMay 2, 2016
  136. Christian CouderMay 3, 2016
  137. 75/83 builtin/apply: make create_one_file() return -1 on errorChristian Couder, Apr 24, 2016
  138. 76/83 builtin/apply: rename option parsing functionsChristian Couder, Apr 24, 2016
  139. 77/83 apply: rename and move opt constants to apply.hChristian Couder, Apr 24, 2016
  140. Ramsay JonesApr 24, 2016
  141. Christian CouderApr 24, 2016
  142. Christian CouderApr 24, 2016
  143. Ramsay JonesApr 24, 2016
  144. Duy NguyenApr 25, 2016
  145. Christian CouderApr 25, 2016
  146. Johannes SchindelinApr 25, 2016
  147. Duy NguyenApr 25, 2016
  148. Christian CouderApr 25, 2016
  149. Duy NguyenApr 25, 2016
  150. Duy NguyenApr 25, 2016
  151. Christian CouderMay 4, 2016
  152. Duy NguyenMay 4, 2016
  153. Christian CouderMay 5, 2016
  154. Christian CouderMay 6, 2016
  155. Junio C HamanoMay 6, 2016
  156. Christian CouderMay 8, 2016

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.