git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH RESEND] Avoid a useless prefix lookup in strbuf_expand()

From
MCMarco 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.

Previous: Junio C Hamano
Message 5 of 5 in “Avoid a useless prefix lookup in strbuf_expand()”
  1. Avoid a useless prefix lookup in strbuf_expand()Marco Costalba, Feb 2, 2008
  2. Junio C HamanoFeb 3, 2008
  3. Marco CostalbaFeb 3, 2008
  4. Junio C HamanoFeb 5, 2008
  5. Marco CostalbaFeb 5, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.