Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
3% tighter packs for free
author
Nicolas Pitre
<nico@cam.org>
Sat, 18 Mar 2006 03:45:07 +0000
(22:45 -0500)
committer
Junio C Hamano
<junkio@cox.net>
Sat, 18 Mar 2006 04:42:39 +0000
(20:42 -0800)
This patch makes for 3.4% smaller pack with the git repository, and
a bit more than 3% smaller pack with the kernel repository.
And so with _no_ measurable CPU difference.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff-delta.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
71bb103
)
diff --git
a/diff-delta.c
b/diff-delta.c
index aaee7be4d20dade99d351f6bdd70632cf249230e..1188b31cd0f1e2f3a1fc2096a10243a03b439021 100644
(file)
--- a/
diff-delta.c
+++ b/
diff-delta.c
@@
-136,7
+136,8
@@
void *diff_delta(void *from_buf, unsigned long from_size,
unsigned long *delta_size,
unsigned long max_size)
{
unsigned long *delta_size,
unsigned long max_size)
{
- unsigned int i, outpos, outsize, inscnt, hash_shift;
+ unsigned int i, outpos, outsize, hash_shift;
+ int inscnt;
const unsigned char *ref_data, *ref_top, *data, *top;
unsigned char *out;
struct index *entry, **hash;
const unsigned char *ref_data, *ref_top, *data, *top;
unsigned char *out;
struct index *entry, **hash;
@@
-222,6
+223,20
@@
void *diff_delta(void *from_buf, unsigned long from_size,
unsigned char *op;
if (inscnt) {
unsigned char *op;
if (inscnt) {
+ while (moff && ref_data[moff-1] == data[-1]) {
+ if (msize == 0x10000)
+ break;
+ /* we can match one byte back */
+ msize++;
+ moff--;
+ data--;
+ outpos--;
+ if (--inscnt)
+ continue;
+ outpos--; /* remove count slot */
+ inscnt--; /* make it -1 */
+ break;
+ }
out[outpos - inscnt - 1] = inscnt;
inscnt = 0;
}
out[outpos - inscnt - 1] = inscnt;
inscnt = 0;
}