Subject: Re: [PATCH 2/2] Implement a simple delta_base cache

From: Junio C Hamano <[email-masked]>
Date: Sun, 18 Mar 2007 00:47:14 -0700

Nicolas Pitre <[email-masked]> writes:

> A malloc() + memcpy() will always be faster than mmap() + malloc() + 
> inflate().  If the data is already there it is certainly better to copy 
> it straight away.

I do not know if there is mmap() cost involved, but you are
correct to point out that my aversion to malloc() cost was
unfounded.  We need to allocate anyway, and memcpy() should of
course be cheaper than inflate().

> With the patch below I can do 'git log drivers/scsi/ > /dev/null' about 
> 7% faster.  I bet it might be even more on those platforms with bad 
> mmap() support.

Wonderful.  I was going to nitpick but you even took care of the
convention of returning a buffer with one extra byte that
terminates the contents with NUL.  Perfect.