diff-delta: allow reusing of the reference buffer index
authorNicolas Pitre <nico@cam.org>
Tue, 28 Feb 2006 04:38:28 +0000 (23:38 -0500)
committerJunio C Hamano <junkio@cox.net>
Thu, 2 Mar 2006 05:53:22 +0000 (21:53 -0800)
commit38fd0721d0a2a1a723bc28fc0817e3571987b1ef
treef2bb05ddb2759ba51d540195d26b30570d7063b5
parent5bb86b82ba18dd2eb736c4f5565f9c920f815b8f
diff-delta: allow reusing of the reference buffer index

When a reference buffer is used multiple times then its index can be
computed only once and reused multiple times.  This patch adds an extra
pointer to a pointer argument (from_index) to diff_delta() for this.

If from_index is NULL then everything is like before.

If from_index is non NULL and *from_index is NULL then the index is
created and its location stored to *from_index.  In this case the caller
has the responsibility to free the memory pointed to by *from_index.

If from_index and *from_index are non NULL then the index is reused as
is.

This currently saves about 10% of CPU time to repack the git archive.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
delta.h
diff-delta.c
diffcore-break.c
diffcore-rename.c
pack-objects.c
test-delta.c