From: "Jon Smirl" <jonsmirl@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Subject: Performance problem, long run of identical hashes
Date: Mon, 10 Dec 2007 10:07:50 -0500 [thread overview]
Message-ID: <9e4733910712100707i66e185bofe22805b8e0ba4d8@mail.gmail.com> (raw)
Running oprofile during my gcc repack shows this loop as the hottest
place in the code by far. I added some debug printfs which show that I
have a 100,000+ run of identical hash entries. Processing the 100,000
entries also causes RAM consumption to explode.
create_delta()
for (entry = index->hash[i]; entry < index->hash[i+1]; entry++) {
const unsigned char *ref = entry->ptr;
const unsigned char *src = data;
unsigned int ref_size = ref_top - ref;
if (entry->val != val)
continue;
if (ref_size > top - src)
ref_size = top - src;
if (ref_size <= msize)
break;
while (ref_size-- && *src++ == *ref)
ref++;
if (msize < ref - entry->ptr) {
/* this is our best match so far */
msize = ref - entry->ptr;
moff = entry->ptr - ref_data;
if (msize >= 4096) /* good enough */
break;
}
}
--
Jon Smirl
jonsmirl@gmail.com
next reply other threads:[~2007-12-10 15:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-10 15:07 Jon Smirl [this message]
2007-12-10 15:45 ` Performance problem, long run of identical hashes Nicolas Pitre
2007-12-10 16:14 ` David Kastrup
2007-12-10 16:20 ` Jon Smirl
2007-12-10 16:30 ` Nicolas Pitre
2007-12-10 19:39 ` David Kastrup
2007-12-10 20:11 ` Nicolas Pitre
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=9e4733910712100707i66e185bofe22805b8e0ba4d8@mail.gmail.com \
--to=jonsmirl@gmail.com \
--cc=git@vger.kernel.org \
/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).