Re: [PATCH 2/2] pack-objects: fix threaded load balancing
- From
Jon Smirl <jonsmirl@gmail.com>
- Date
- Dec 10, 2007, 06:19 UTC
- Message-ID
- <9e4733910712092219kd86e576k33b11c93179f6475@mail.gmail.com>
- In-Reply-To
- <9e4733910712092206o40e0c748s3796b95f637bf2b3@mail.gmail.com>
It seems to be caused by looping over those runs of 100,000 identical hash entries. 5091699 24.6407 : for (entry = index->hash[i]; entry < index->hash[i+1]; entry++) { 5301791 25.6575 : const unsigned char *ref = entry->ptr;
228772 1.1071 : while (data < top) {
223646 1.0823 : if (msize < 4096) {
: struct index_entry *entry;
5862 0.0284 : val ^= U[data[-RABIN_WINDOW]];
753004 3.6441 : val = ((val << 8) | *data) ^
T[val >> RABIN_SHIFT];
1232556 5.9648 : i = val & index->hash_mask;
5091699 24.6407 : for (entry = index->hash[i];
entry < index->hash[i+1]; entry++) {
5301791 25.6575 : const unsigned char
*ref = entry->ptr;
: const unsigned char *src = data;
25919 0.1254 : unsigned int ref_size
= ref_top - ref;
740077 3.5815 : if (entry->val != val)
: continue;
331 0.0016 : if (ref_size > top - src)
83804 0.4056 : ref_size = top - src;
25059 0.1213 : if (ref_size <= msize)
: break;
1269621 6.1442 : while (ref_size-- &&
*src++ == *ref)
42122 0.2038 : ref++;
14362 0.0695 : if (msize < ref - entry->ptr) {
: /* this is our
best match so far */
10452 0.0506 : msize = ref -
entry->ptr;
6882 0.0333 : moff =
entry->ptr - ref_data;
6382 0.0309 : if (msize >=
4096) /* good enough */
: break;
: }
: }-- Jon Smirl jonsmirl@gmail.com