From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: three-way diff performance problem
Date: Tue, 21 Jul 2009 12:31:50 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0907211225220.19335@localhost.localdomain> (raw)
In-Reply-To: <7v7hy1g7vg.fsf@alter.siamese.dyndns.org>
On Tue, 21 Jul 2009, Junio C Hamano wrote:
>
> What's that cmovne?
It's "conditional move if not equal".
So the source code is
/* We cannot squash it with earlier one */
for (lline = sline->lost_head;
lline;
lline = lline->next)
if (lline->parent_map & this_mask)
last_one = lline;
adn the compiler has generated this:
loop:
test %r14,0x10(%rdx)
cmovne %rdx,%rcx
mov (%rdx),%rdx
test %rdx,%rdx
jne loop
from it. In the above, '%r14' contains this_mask, and '%rcx' contains
'last_line' and '%rdx' contains 'lline'.
So:
- test %r14,0x10(%rdx)
test "this_mask & lline->parent_map"
- cmovne %rdx,%rcx
"if the test above was non-zero, then last_one = lline"
- mov (%rdx),%rdx
"lline = lline->next"
- test %rdx,%rdx
"is lline NULL"
- jne loop
no, continue.
> The function append_lost() is the meat of combining. When you have seen
> a hunk like this:
>
> @@ -l,k +m,n @@
> -lost line
> -another lost line
> common line
> +added line
>
> We queue the lost lines in front of a surviving line (that is sline that
> points at "common line"). "lost line" and "another lost line" are stored
> in lline (lost line) and they are queued to sline->lost_head.
Right. And "sline->lost_head" is going to have over a _million_ entries.
So each time you add one, we'll traverse that loop a million times. For
each new entry. End result: that loop gets executed on the order of a
million million times. It doesn't help that the compiler made it be very
efficient code ;(
Linus
next prev parent reply other threads:[~2009-07-21 19:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 18:10 three-way diff performance problem Linus Torvalds
2009-07-21 18:16 ` Linus Torvalds
2009-07-21 19:21 ` Junio C Hamano
2009-07-21 19:31 ` Linus Torvalds [this message]
2009-07-21 19:47 ` Junio C Hamano
2009-07-21 20:34 ` Linus Torvalds
2009-07-21 20:46 ` Junio C Hamano
2009-07-21 21:01 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.01.0907211225220.19335@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).