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

Re: [RFC] strbuf's in builtin-apply

From
Pierre Habouzit <madcoder@debian.org>
Date
Sep 16, 2007, 17:21 UTC
Message-ID
<20070916172134.GA26457@artemis.corp>
In-Reply-To
<20070915141210.GA27494@artemis.corp>

Following this mail will happen a new janitoring series. This is a rewrite of the former, using Junio's advice to use strbufs in convert_to_* functions. The patch hence becomes more intrusive than before (in convert.c mostly). Note that this imply that now strbuf.h is included from cache.h so all git sources see strbuf's.

The convert_to_git patches gain some marginal efficiency as the new API makes the reuse of the buffers possible when in-place editing works (e.g. the \r\n -> \n can be done in place, we save a malloc here). Else nothing should have changed significantly.

The last 2 patches are new. The first one is a simplification of the code splicing the "encoding" header in commit.c, reusing the logic already in strbuf.c for that matter, and also making the parsing code easier to read (IMHO).

The latter further simplify some code that was trying to guess if rfc2047 encoding of some header was needed. Thanks to strbuf_grow, and the fact that now at each point we can grow buffers (which was harder before), I tried to wait until we are sure if rfc2047 encoding will be needed or not to extend the buffer. I've benchmarked many tools (on real repositories, with commiters having non ascii chars in their name) using the pretty printer without noticeable changes in the numbers (and rather again, a trend to be faster, but with less than a percent gain, so I won't call it a real gain).

The series is based on next, as many patches are definitely not suitable for master :)

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Pierre HabouzitNext: Pierre Habouzit
Message 9 of 21 in “[RFC] strbuf's in builtin-apply”
  1. Pierre HabouzitSep 15, 2007
  2. New strbuf APIs: splice and embed.Pierre Habouzit, Sep 15, 2007
  3. Junio C HamanoSep 16, 2007
  4. Pierre HabouzitSep 16, 2007
  5. builtin-apply: use strbuf's instead of buffer_desc's.Pierre Habouzit, Sep 15, 2007
  6. Junio C HamanoSep 16, 2007
  7. Pierre HabouzitSep 16, 2007
  8. Pierre HabouzitSep 15, 2007
  9. Pierre HabouzitSep 16, 2007
  10. New strbuf APIs: splice and attach.Pierre Habouzit, Sep 15, 2007
  11. Florian WeimerSep 16, 2007
  12. Pierre HabouzitSep 16, 2007
  13. Florian WeimerSep 17, 2007
  14. Now that cache.h needs strbuf.h, remove useless includes.Pierre Habouzit, Sep 15, 2007
  15. Refactor replace_encoding_header.Pierre Habouzit, Sep 15, 2007
  16. Remove preemptive allocations.Pierre Habouzit, Sep 16, 2007
  17. Rewrite convert_to_{git,working_tree} to use strbuf's.Pierre Habouzit, Sep 16, 2007
  18. Linus TorvaldsSep 16, 2007
  19. builtin-apply: use strbuf's instead of buffer_desc's.Pierre Habouzit, Sep 16, 2007
  20. Pierre HabouzitSep 16, 2007
  21. Junio C HamanoSep 16, 2007

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.