sha1write: don't copy full sized buffers
authorNicolas Pitre <nico@cam.org>
Tue, 2 Sep 2008 14:22:20 +0000 (10:22 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Sep 2008 00:05:47 +0000 (17:05 -0700)
commita8032d12241f2226a6ab98272b12a1d98ca446a5
tree4c05ad594960539a478a2646fcb2b22c66a68aaa
parent59d94bc9c851f9f4086a857bc6277feca6a48824
sha1write: don't copy full sized buffers

No need to memcpy() source buffer data when we might just process the
data in place instead of accumulating it into a separate buffer.
This is the case when a whole buffer would have been copied, summed,
written out and then discarded right away.

Also move the CRC32 processing within the loop so the data is more likely
to remain in the L1 CPU cache between the CRC32 sum, SHA1 sum and the
write call.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
csum-file.c