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

Re: git cherry improvements suggestions

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 24, 2011, 07:47 UTC
Message-ID
<4D8AF6FF.4080209@drmicha.warpmail.net>
In-Reply-To
<AANLkTi=7NKn4FrCqFaGH+XTHRw3oLCv=aKPWAJfNsgD_@mail.gmail.com>
Piotr Krukowiecki venit, vidit, dixit 24.03.2011 08:40:
Show 102 quoted lines
> On Wed, Mar 23, 2011 at 8:28 PM, Piotr Krukowiecki
> <piotr.krukowiecki@gmail.com> wrote:
>> On Wed, Mar 23, 2011 at 3:44 PM, Michael J Gruber
>> <git@drmicha.warpmail.net> wrote:
>>> Piotr Krukowiecki venit, vidit, dixit 23.03.2011 15:43:
>>>> On Wed, Mar 23, 2011 at 2:33 PM, Michael J Gruber
>>>> <git@drmicha.warpmail.net> wrote:
>>>>> Piotr Krukowiecki venit, vidit, dixit 23.03.2011 14:23:
>>>>>> Just some stats:
>>>>>>
>>>>>>    git log --cherry-mark --left-right --oneline --date-order branch...trunk
>>>>>>
>>>>>> lists 1004 commits, takes about 20s and memory peaks to about 670MB
>>>>>> twice during the run (I'm on linux with AMD Phenom II X4 945)
>>>>>>
>>>>>> With limit it prints X last commits (the limiting seems to take place after all
>>>>>> work, on the output list only).
>>>>>>
>>>>>> branch..trunk is 551 commits, the other way is 453 commits.
>>>>>> 710 commits are found to be "=", 98 "<", 196 ">".
>>>>>>
>>>>>> Note, I'm not saying it's too slow, or that it's working incorrectly, I'm just
>>>>>> giving real-life stats if anyone was interested.
>>>>>> I suspect such checks won't be done frequently.
>>>>>
>>>>> You don't need to say it's slow - I've said so already :(
>>>>>
>>>>> http://permalink.gmane.org/gmane.comp.version-control.git/169725
>>>>
>>>> In the link above:
>>>>   git cherry A B: 0.4s
>>>>   git rev-list --cherry A...B: 1.7s
>>>>
>>>> So rev-list is 4.25x slower.
>>>>
>>>> In my case it's only 1.23x slower:
>>>>
>>>>    $ time git rev-list --cherry branch...trunk  > /tmp/rev-list
>>>>    real       0m18.627s
>>>>    user       0m17.710s
>>>>    sys        0m0.900s
>>>>
>>>>    $ time git cherry  branch trunk  > /tmp/cherry
>>>>    real       0m15.345s
>>>>    user       0m14.310s
>>>>    sys        0m1.020s
>>>>
>>>>
>>>
>>> How's that with > /dev/null (or with --count for rev-list)? Also, how
>>> many merge bases do you have:
>>>
>>> git merge-base --all branch trunk | wc -l
>>
>> I expect only one - there should be no merges between those two
>> branches.
>>
>> I will do measurements tomorrow.
> 
> 
> Branches might change a bit since yesterday so the exact numbers
> might be a bit different.
> 
> 
> $ time git cherry  branch trunk  > /dev/null
> 
> real	0m15.246s
> user	0m14.260s
> sys	0m0.970s
> 
> 
> $ time git rev-list --cherry branch...trunk  > /dev/null
> 
> real	0m18.801s
> user	0m17.980s
> sys	0m0.800s
> 
> 
> $ time git rev-list --cherry --count branch...trunk
> 556
> 
> real	0m18.825s
> user	0m18.010s
> sys	0m0.770s
> 
> 
> $ time git merge-base --all branch trunk  | wc -l
> 2
> 
> real	0m0.538s
> user	0m0.490s
> sys	0m0.040s
> 
> 
> I expected one merge base, but it appears our history is
> seriously fscked, either by past svn operations or by
> git-svn clone :)
> 
> (I'm not saying there's an error somewhere, just that the
> history is ... complicated)
> 
> 

Thanks for the timings. In your case with only 2 merge bases, the merge base calculation (or rather: simplification) does not make much of a difference, at most 0.5s as we see. I'm still wondering where the rest of the 3.5s difference (between cherry and --cherry) is spent, but at least the ratio 18.8/15.2 is more bearable than in my case. Unfortunately, this confirms my suspicion that there is more than 1 area which would need improvement to match cherry's speed.

Michael
Previous: Piotr Krukowiecki
Message 9 of 9 in “git cherry improvements suggestions”
  1. Piotr KrukowieckiMar 23, 2011
  2. Michael J GruberMar 23, 2011
  3. Piotr KrukowieckiMar 23, 2011
  4. Michael J GruberMar 23, 2011
  5. Piotr KrukowieckiMar 23, 2011
  6. Michael J GruberMar 23, 2011
  7. Piotr KrukowieckiMar 23, 2011
  8. Piotr KrukowieckiMar 24, 2011
  9. Michael J GruberMar 24, 2011

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.