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

Re: [PATCH] find_containing_dir(): allocate strbuf less extravagantly

From
Jeff King <peff@peff.net>
Date
May 22, 2012, 17:34 UTC
Message-ID
<20120522173448.GD11600@sigill.intra.peff.net>
In-Reply-To
<1337692566-3718-1-git-send-email-mhagger@alum.mit.edu>
On Tue, May 22, 2012 at 03:16:06PM +0200, mhagger@alum.mit.edu wrote:
Show 19 quoted lines
> From: Michael Haggerty <mhagger@alum.mit.edu>
> 
> It might seem like allocating a fixed-length buffer of uninitialized
> memory should be pretty cheap even if the buffer is of size PATH_MAX.
> But empirically, it is measurably faster to allocated only the strlen
> of the input string.
> 
> Thanks to Peff for pointing out a performance regression in this area
> that might be fixed by this patch.
> 
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
> I am not able to reproduce performance regressions as bad as those
> observed by Peff.  It seems to depend on the amount of memory
> pressure.  The smaller regression that I *did* see is fixed by this
> patch, reducing the time for "git fetch . refs/*:refs/*" from 10.1 s
> to 9.3 s.  The change is sensible in any case, but we will have to
> wait for Peff's verdict about whether it fixes the whole problem for
> him, too.

I see a similar small improvement. So I think it is worth doing, but it does not fix the main regression I found.

-Peff
Previous: mhagger@alum.mit.eduNext: René Scharfe
Message 2 of 12 in “find_containing_dir(): allocate strbuf less extravagantly”
  1. find_containing_dir(): allocate strbuf less extravagantlymhagger@alum.mit.edu, May 22, 2012
  2. Jeff KingMay 22, 2012
  3. 1/3 refs: convert parameter of search_ref_dir() to length-limited stringRené Scharfe, May 22, 2012
  4. 2/3 refs: convert parameter of create_dir_entry() to length-limited stringRené Scharfe, May 22, 2012
  5. 3/3 refs: use strings directly in find_containing_dir()René Scharfe, May 22, 2012
  6. Junio C HamanoMay 22, 2012
  7. René ScharfeMay 22, 2012
  8. Junio C HamanoMay 22, 2012
  9. René ScharfeMay 23, 2012
  10. Junio C HamanoMay 23, 2012
  11. René ScharfeMay 23, 2012
  12. Michael HaggertyMay 24, 2012

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.