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

Re: The git spring cleanup challenge

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Jun 4, 2021, 10:24 UTC
Message-ID
<3edd4518-00bd-6227-54e5-e546fd6b849b@gmail.com>
In-Reply-To
<87tume6g0g.fsf@evledraar.gmail.com>

Hi Ævar On 03/06/2021 17:44, Ævar Arnfjörð Bjarmason wrote:

Show 33 quoted lines
> 
> On Thu, Jun 03 2021, Phillip Wood wrote:
> 
>> Hi Ævar
>>
>> On 03/06/2021 13:31, Ævar Arnfjörð Bjarmason wrote:
>>> On Thu, Jun 03 2021, Felipe Contreras wrote:
>>>
>>>> Ævar Arnfjörð Bjarmason wrote:
>>>>> So I skipped the "disable most config", but for what it's worth I think
>>>>> I'd miss these the most, I couldn't pick just N favorites, sorry:
>>>>>
>>>>>    * diff.colorMoved=true: super useful, but I'd be vary of turning it on
>>>>>      by default in its current form. E.g. on gcc.git's changelog files it
>>>>>      has really pathological performance characteristics.
>>
>> Would you be able say a bit more about this so I can try and reproduce
>> it please. I'm working on some patches [1] to improve the performance
>> of `diff --color-moved` and `diff --color-moved-ws` and it would be
>> good to test them on a problematic repo. At the moment I diffing two
>> releases of git to test performance on a large diff. I just cloned the
>> last 18 months of gcc.git and Changelog seems to just be appended to.
> 
> I misremembered the gcc.git ChangeLog issue, sorry. That's about
> something else entirely.
> 
> The issue with the color moved code can just be reproduced on most large
> diffs, e.g. on git.git:
>      
>      $ time git diff --color-moved=true v2.25.0..v2.30.0 >/dev/null
>      real    0m10.112s
>      $ time git diff --color-moved=false v2.25.0..v2.30.0 >/dev/null
>      real    0m0.939s

"Big diffs are slow with --color-moved" is the problem I've been focusing on. With my patches I see the time for --color-moved=true go down from 16s to 4.3s for that example. --color-moved=false takes 0.8s so the --color-moved=true is still quite a bit slower but it's not as bad. --color-moved-ws=allow-indentation-change goes from 8 minutes(!) to 6 seconds. I'm seeing a slight (few percent) slowdown for `git log --patch --no-merges -n1000` though which I'd like to avoid.

Show 12 quoted lines
> So 10x slower, and e.g. diffing from v2.22.0 makes it 25s and 1.1s,
> respectively.
>
> In some sense that slowness is expected, it simly takes time to compute
> this. I think for turning it on by default we should have something like
> the diff.renameLimit, and change the default to some "auto" that would
> punt out if it was taking too long to compute.
> 
> I run with it by default so this doesn't bother me, but I think it's
> probably a semi-common use-case of some people to e.g. diff the last N
> releases of Linux, and then use their pager to search around in the
> diff.
Yeah I can see people doing that.
Show 7 quoted lines
> We don't want commands like that to take 25s instead of 1s, but I think
> it would be fine (and we should) warn that we aborted on the color move
> if it's otherwise the default.
> 
> Otherwise it'll take 1s, and if you normally depend on it you'll
> conclude that some code you're looking at wasn't moved, which would also
> suck, better to punt on it and warn, just like the diff.renameLimit.

That's a nice idea, one other thought I had was to fall back to just looking for moved lines within the same file - that would be much faster on a large diff with lots of files but maybe it is confusing to highlight only some of the moved lines when there are interfile as well as intrafile moves.

Best Wishes
Phillip
Show 13 quoted lines
> 
>>>> Very nice! I didn't know about it. I'll pick it for my third day.
>>> It makes patch review a lot easier, and also integrates nicely with
>>> -w.
>>
>> I find --color-moved-ws=allow-indentation-change helpful as well (it
>> is quite a bit slower at the moment but I have some patches to bring
>> it up to the speed of the other --color-moved modes.
>>
>> [1] https://github.com/phillipwood/git/tree/wip/diff-color-moved-tweaks
> 
> Nice, I didn't know about that option. Will try it.
> 
Previous: Ævar Arnfjörð BjarmasonNext: Felipe Contreras
Message 54 of 55 in “The git spring cleanup challenge”
  1. Felipe ContrerasJun 1, 2021
  2. AndyJun 1, 2021
  3. Felipe ContrerasJun 1, 2021
  4. Đoàn Trần Công DanhJun 1, 2021
  5. Felipe ContrerasJun 1, 2021
  6. Đoàn Trần Công DanhJun 1, 2021
  7. Felipe ContrerasJun 1, 2021
  8. Đoàn Trần Công DanhJun 1, 2021
  9. Felipe ContrerasJun 1, 2021
  10. Đoàn Trần Công DanhJun 2, 2021
  11. Felipe ContrerasJun 2, 2021
  12. Ævar Arnfjörð BjarmasonJun 3, 2021
  13. Felipe ContrerasJun 3, 2021
  14. Sergey OrganovJun 3, 2021
  15. Ævar Arnfjörð BjarmasonJun 3, 2021
  16. Felipe ContrerasJul 2, 2021
  17. Ævar Arnfjörð BjarmasonJul 2, 2021
  18. Felipe ContrerasJul 2, 2021
  19. David AguilarJun 1, 2021
  20. Junio C HamanoJun 1, 2021
  21. Junio C HamanoJun 1, 2021
  22. Felipe ContrerasJun 1, 2021
  23. Johannes SixtJun 2, 2021
  24. Felipe ContrerasJun 2, 2021
  25. Junio C HamanoJun 2, 2021
  26. Felipe ContrerasJun 2, 2021
  27. Đoàn Trần Công DanhJun 2, 2021
  28. Johannes SixtJun 2, 2021
  29. Felipe ContrerasJun 1, 2021
  30. Sergey OrganovJun 2, 2021
  31. Junio C HamanoJun 3, 2021
  32. Sergey OrganovJun 3, 2021
  33. Sergey OrganovJun 1, 2021
  34. Felipe ContrerasJun 1, 2021
  35. Sergey OrganovJun 2, 2021
  36. Felipe ContrerasJun 2, 2021
  37. Sergey OrganovJun 2, 2021
  38. Felipe ContrerasJun 2, 2021
  39. Sergey OrganovJun 2, 2021
  40. Junio C HamanoJun 3, 2021
  41. Felipe ContrerasJun 3, 2021
  42. Elijah NewrenJun 3, 2021
  43. Felipe ContrerasJun 3, 2021
  44. Elijah NewrenJun 3, 2021
  45. Felipe ContrerasJun 3, 2021
  46. Sergey OrganovJun 3, 2021
  47. Bagas SanjayaJun 2, 2021
  48. Felipe ContrerasJun 2, 2021
  49. Ævar Arnfjörð BjarmasonJun 3, 2021
  50. Felipe ContrerasJun 3, 2021
  51. Ævar Arnfjörð BjarmasonJun 3, 2021
  52. Phillip WoodJun 3, 2021
  53. Ævar Arnfjörð BjarmasonJun 3, 2021
  54. Phillip WoodJun 4, 2021
  55. Felipe ContrerasJun 3, 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.