Subject: Re: RFC: New diff-delta.c implementation

From: Rene Scharfe <[email-masked]>
Date: Sat, 22 Apr 2006 14:36:04 +0200

Hello Geert,

Geert Bosch schrieb:
> I wrote a new binary differencing algorithm that is both faster and
> generates smaller deltas than the current implementation. The format
> is compatible with that used by patch-delta, so it should be easy to
> integrate.
[...]
> Initial testing seems quite positive, take for example git-1.2.5.tar
> vs git-1.2.6.tar on my PowerBook (both with -O2 -DNDEBUG):
> 
> current: 2.281s, patch size 36563
> new    : 0.109s, patch size 16199
> 
> Please feel free to play around with this code, and give feedback. 
> Keep in mind this wasn't originally written for GIT, and C is not my
> native language, so don't mind my formatting etc.

nice speedup!  Though I cannot comment on what it actually does, I have
some comments on style. B-)

Could you please send your code inline, not as an attachment?  And
possibly as a patch with a Signed-off-by: tag (see
Documentation/SubmittingPatches)?

Regarding your FIXME comment about endianess: I think you are looking
for htonl().  Use it to convert the values from host byte order to
network byte order (= big endian) and you can get rid of those ugly
branches.

You can use "indent -npro -kr -i8 -ts8 -l80 -ss -ncs" to reformat your
code into a similar style as used in the rest of git (settings taken
from Lindent which is shipped with the Linux source).

After converting to htonl() "make test" ran fine on my x86 box.  Here is
what I get when I try to repack the git repo, though:

   $ git repack -a -d
   Generating pack...
   Done counting 18985 objects.
   Deltifying 18985 objects.
   git-pack-objects: diff-delta.c:766: create_delta: Assertion `ptr -
delta == (int)delta_size' failed.

Please let me know if you need more details.

Thanks,
René