Re: [PATCH] 3% tighter packs for free
- From
Junio C Hamano <junkio@cox.net>
- Date
- Mar 18, 2006, 07:21 UTC
- Message-ID
- <7vwtesxloi.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0603172205490.4889@localhost.localdomain>
Nicolas Pitre <nico@cam.org> writes:
Show 9 quoted lines
> if (inscnt) {
> + while (moff && ref_data[moff-1] == data[-1]) {
> + if (msize == 0x10000)
> + break;
> + /* we can match one byte back */
> ...
> + break;
> + }
> out[outpos - inscnt - 1] = inscnt;Once you make it into a patch form, it is plainly obvious that this is a good optimization. Since our BLK_SIZE is 16 bytes, you are grabbing up to 15 more bytes (on average 8 more bytes or so) for every match after a partially modified block.
Very nice. I wonder if a larger BLK_SIZE (say 32 bytes) would give us faster packing without losing much compression if we use this idea.