Re: [PATCH 03/11] Use new compress helpers in fast-import
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 3, 2008, 22:53 UTC
- Message-ID
- <7v3as9slc6.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1201952156-6764-3-git-send-email-mcostalba@gmail.com>
Marco Costalba <mcostalba@gmail.com> writes:
Show 8 quoted lines
> Here is slightly more difficult, in particular > a xrealloc() has been substituted with a > free() + xmalloc() to keep the code simple. > > Signed-off-by: Marco Costalba <mcostalba@gmail.com> > --- > fast-import.c | 45 +++++++++++++++------------------------------ > 1 files changed, 15 insertions(+), 30 deletions(-)
I'll let Shawn comment on this. The realloc() does not seem to be using the contents in the buffer from the previous round, so I suspect that a free() followed by an independent alloc() would be an improvement when the later call uses much larger buffer than the previous one, but would be a waste if the later one needs smaller buffer.