Re: [PATCH RESEND] Avoid a useless prefix lookup in strbuf_expand()
- From
- Marco Costalba <mcostalba@gmail.com>
- Date
- Feb 5, 2008, 13:17 UTC
- Message-ID
- <e5bfff550802050517o3f4f5f61n8ed6ab2bce57d25f@mail.gmail.com>
- In-Reply-To
- <7vtzknga5g.fsf@gitster.siamese.dyndns.org>
On Feb 5, 2008 8:00 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> > Another thing I noticed is that --pretty='format:%an %ae %at' > would end up running this function three times. Perhaps it is > worth memoizing the result in format_commit_context while you > are at it? >
Yes, I tought about this. But at the end I rejected this idea to keep the code simple and because the optimization was in any case small (and also in a special cases only).
I did some profiling with and without my patch and I noticed a nice improvement so that with the patch applied git-rev-list and git-log --pretty=format have almost the same execution times.
This is because the biggest time in both cases is spent in zlib decompress, so also a local further speed up of format_person_part() does not gain anything but complicates the code.
Marco
P.S: I will try to adress your concerns on the naming of end_of_data flag (hints are welcomed, I'm bad at naming) and on the skipping further elaborations if end_of_data is true to have cleaner code, I was thinking about using 'goto xxxx' or something like that.