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

Re: Rebase performance

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 25, 2016, 03:14 UTC
Message-ID
<CACsJy8DMyD9oo2_3+BdM-M=0eYAi1ip77WTuYt42tBn9DuD+kw@mail.gmail.com>
In-Reply-To
<xmqqvb5dpk5z.fsf@gitster.mtv.corp.google.com>
On Thu, Feb 25, 2016 at 10:02 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> On Thu, Feb 25, 2016 at 5:09 AM, Christian Couder
>> <christian.couder@gmail.com> wrote:
>>> Another possibility would be to libify the "git apply" functionality
>>> and then to use the libified "git apply" in run_apply() instead of
>>> launching a separate "git apply" process. One benefit from this is
>>> that we could probably get rid of the read_cache_from() call at the
>>> end of run_apply() and this would likely further speed up things. Also
>>> avoiding to launch separate processes might be a win especially on
>>> Windows.
>>
>> The amount of global variables in apply.c is just scary. Libification
>> will need some cleanup first (i'm not against it though).
>
> The global variables do not scare me.  You can just throw them into
> a single "apply_state" structure and pass it around the callchain
> just fine--the helper functions in the file all take only a small
> number of parameters, and a new parameter that is a pointer to the
> state structure that consistently comes at the beginning would not
> make things harder to read or maintain.

There are a bunch of shadow variables in this file. If you are not careful, it's easy to mistake local var "x" with global "x" and replace it with global_state->x.

Show 9 quoted lines
> What does scare me (and what you should be scared) more is the way
> the current code handles erroneous input.  It was one of the
> programs written in early days with "just do one thing well and
> exit, the larger program structure will be scripted around us"
> mentality and liberally die() without cleaning things up.  I do
> agree with others that libification of it is a very good thing, but
> the second step (the first step is the easier "global to state
> structure" one, which should be more or less mechanical) towards it
> is to design how the errors are handled and resources are released.

Yeah.. thorough study of apply code may be needed before anybody does any surgery in this code

-- 
Duy
Previous: Junio C HamanoNext: Duy Nguyen
Message 6 of 13 in “Rebase performance”
  1. Christian CouderFeb 24, 2016
  2. Jacob KellerFeb 25, 2016
  3. Stefan BellerFeb 25, 2016
  4. Duy NguyenFeb 25, 2016
  5. Junio C HamanoFeb 25, 2016
  6. Duy NguyenFeb 25, 2016
  7. Duy NguyenFeb 25, 2016
  8. Christian CouderFeb 26, 2016
  9. Ævar Arnfjörð BjarmasonFeb 25, 2016
  10. Matthieu MoyFeb 25, 2016
  11. Johannes SchindelinFeb 26, 2016
  12. Stefan BellerFeb 26, 2016
  13. Christian CouderMar 2, 2016

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.