Performance problem, long run of identical hashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux