git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v3 00/34] libify mailinfo and call it directly from am
Date: Wed, 21 Oct 2015 16:51:50 +0100	[thread overview]
Message-ID: <5627B496.7030102@ramsayjones.plus.com> (raw)
In-Reply-To: <xmqqh9ll6xo8.fsf@gitster.mtv.corp.google.com>



On 20/10/15 22:24, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> During the discussion on the recent "git am" regression, I noticed
>> that the command reimplemented in C spawns one "mailsplit" and then
>> spawns "mailinfo" followed by "apply --index" to commit the changes
>> described in each message.  As there are platforms where spawning
>> subprocess via run_command() interface is heavy-weight, something
>> that is conceptually very simple like "mailinfo" is better called
>> directly inside the process---something that is lightweight and
>> frequently used is where the overhead of run_command() would be felt
>> most.
> 
> Although I still haven't seen any offer to help from those who work
> on the platforms that may benefit from this series the most, I have
> some numbers on my desktop (Dell T3500 2.66GHz Xeon X5650 with 12GB,
> running Ubuntu), where the cost of spawning is not as costly as
> elsewhere, making this series less pressing.

I suspect that I haven't tested exactly the same version as you, but I had
a quick look at testing this on Cygwin today. I have included a complete
transcript (below), so you can see what I did wrong! :-P

> 
> Between 'master' and the version with this series (on 'jch'),
> applying this 34-patch series itself on top of 'master' using "git
> am", best of 5 numbers for running:
> 
>     time git am mbox >/dev/null
> 
> are
> 
>       (master)                 (with the series)
>     real    0m0.648s            real    0m0.537s
>     user    0m0.358s            user    0m0.338s
>     sys     0m0.172s            sys     0m0.154s
> 

The corresponding times for me were:

    (master)           (with the series)
  real	0m9.760s      real	0m5.744s
  user	0m0.531s      user	0m0.656s
  sys	0m5.726s      sys	0m3.520s

So, yes, a noticeable improvement! :)

HTH

ATB,
Ramsay Jones

  $ uname -a
  CYGWIN_NT-6.3 satellite 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64 Cygwin
  $ pwd
  /home/ramsay/git
  $ git log --decorate --oneline -1
  74301d6 (HEAD -> master, origin/master, origin/HEAD) Sync with maint
  $ ./git version
  git version 2.6.2.280.g74301d6
  $ git format-patch --stdout 2a5ce7c^..896df93 >mailinfo.mbox
  $ git format-patch --stdout a4106a8^..559e247 >>mailinfo.mbox
  $ git checkout -b master-mailinfo master
  Switched to a new branch 'master-mailinfo'
  $ time ./git am mailinfo.mbox
  Applying: mailinfo: remove a no-op call convert_to_utf8(it, "")
  Applying: mailinfo: fold decode_header_bq() into decode_header()
  Applying: mailinfo: fix an off-by-one error in the boundary stack
  Applying: mailinfo: explicitly close file handle to the patch output
  Applying: mailinfo: move handle_boundary() lower
  Applying: mailinfo: get rid of function-local static states
  Applying: mailinfo: do not let handle_body() touch global "line" directly
  Applying: mailinfo: do not let handle_boundary() touch global "line" directly
  Applying: mailinfo: do not let find_boundary() touch global "line" directly
  Applying: mailinfo: move global "line" into mailinfo() function
  Applying: mailinfo: introduce "struct mailinfo" to hold globals
  Applying: mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo
  Applying: mailinfo: move global "FILE *fin, *fout" to struct mailinfo
  Applying: mailinfo: move filter/header stage to struct mailinfo
  Applying: mailinfo: move patch_lines to struct mailinfo
  Applying: mailinfo: move add_message_id and message_id to struct mailinfo
  Applying: mailinfo: move use_scissors and use_inbody_headers to struct mailinfo
  Applying: mailinfo: move metainfo_charset to struct mailinfo
  Applying: mailinfo: move check for metainfo_charset to convert_to_utf8()
  Applying: mailinfo: move transfer_encoding to struct mailinfo
  Applying: mailinfo: move charset to struct mailinfo
  Applying: mailinfo: move cmitmsg and patchfile to struct mailinfo
  Applying: mailinfo: move [ps]_hdr_data to struct mailinfo
  Applying: mailinfo: move content/content_top to struct mailinfo
  Applying: mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak
  Applying: mailinfo: keep the parsed log message in a strbuf
  Applying: mailinfo: move read_one_header_line() closer to its callers
  Applying: mailinfo: move check_header() after the helpers it uses
  Applying: mailinfo: move cleanup_space() before its users
  Applying: mailinfo: move definition of MAX_HDR_PARSED closer to its use
  Applying: mailinfo: libify
  Applying: mailinfo: handle charset conversion errors in the caller
  Applying: mailinfo: remove calls to exit() and die() deep in the callchain
  Applying: am: make direct call to mailinfo
  Applying: mailinfo: plug strbuf leak during continuation line handling
  
  real	0m9.760s
  user	0m0.531s
  sys	0m5.726s
  $ 
  
  $ make clean >/dev/null 2>&1
  $ make >out.mi 2>&1
  $ ./git version
  git version 2.6.2.315.g1e9f6ff
  $ git describe
  v2.6.2-315-g1e9f6ff
  $ git checkout -b new-mailinfo master
  Switched to a new branch 'new-mailinfo'
  $ time ./git am mailinfo.mbox
  Applying: mailinfo: remove a no-op call convert_to_utf8(it, "")
  Applying: mailinfo: fold decode_header_bq() into decode_header()
  Applying: mailinfo: fix an off-by-one error in the boundary stack
  Applying: mailinfo: explicitly close file handle to the patch output
  Applying: mailinfo: move handle_boundary() lower
  Applying: mailinfo: get rid of function-local static states
  Applying: mailinfo: do not let handle_body() touch global "line" directly
  Applying: mailinfo: do not let handle_boundary() touch global "line" directly
  Applying: mailinfo: do not let find_boundary() touch global "line" directly
  Applying: mailinfo: move global "line" into mailinfo() function
  Applying: mailinfo: introduce "struct mailinfo" to hold globals
  Applying: mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo
  Applying: mailinfo: move global "FILE *fin, *fout" to struct mailinfo
  Applying: mailinfo: move filter/header stage to struct mailinfo
  Applying: mailinfo: move patch_lines to struct mailinfo
  Applying: mailinfo: move add_message_id and message_id to struct mailinfo
  Applying: mailinfo: move use_scissors and use_inbody_headers to struct mailinfo
  Applying: mailinfo: move metainfo_charset to struct mailinfo
  Applying: mailinfo: move check for metainfo_charset to convert_to_utf8()
  Applying: mailinfo: move transfer_encoding to struct mailinfo
  Applying: mailinfo: move charset to struct mailinfo
  Applying: mailinfo: move cmitmsg and patchfile to struct mailinfo
  Applying: mailinfo: move [ps]_hdr_data to struct mailinfo
  Applying: mailinfo: move content/content_top to struct mailinfo
  Applying: mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak
  Applying: mailinfo: keep the parsed log message in a strbuf
  Applying: mailinfo: move read_one_header_line() closer to its callers
  Applying: mailinfo: move check_header() after the helpers it uses
  Applying: mailinfo: move cleanup_space() before its users
  Applying: mailinfo: move definition of MAX_HDR_PARSED closer to its use
  Applying: mailinfo: libify
  Applying: mailinfo: handle charset conversion errors in the caller
  Applying: mailinfo: remove calls to exit() and die() deep in the callchain
  Applying: am: make direct call to mailinfo
  Applying: mailinfo: plug strbuf leak during continuation line handling
  
  real	0m5.744s
  user	0m0.656s
  sys	0m3.520s
  $ 

  $ git rev-parse master-mailinfo^{tree} new-mailinfo^{tree}
  cebb1a110f3af9f4393bb66b942ae28e2743f233
  cebb1a110f3af9f4393bb66b942ae28e2743f233
  $ 

  parent reply	other threads:[~2015-10-21 15:51 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 23:16 [PATCH 00/26] mailinfo libification Junio C Hamano
2015-10-13 23:16 ` [PATCH 01/26] mailinfo: remove a no-op call convert_to_utf8(it, "") Junio C Hamano
2015-10-13 23:16 ` [PATCH 02/26] mailinfo: fix for off-by-one error in boundary stack Junio C Hamano
2015-10-14 20:12   ` Stefan Beller
2015-10-14 20:28     ` Junio C Hamano
2015-10-13 23:16 ` [PATCH 03/26] mailinfo: fold decode_header_bq() into decode_header() Junio C Hamano
2015-10-13 23:16 ` [PATCH 04/26] mailinfo: move handle_boundary() lower Junio C Hamano
2015-10-13 23:16 ` [PATCH 05/26] mailinfo: get rid of function-local static states Junio C Hamano
2015-10-13 23:16 ` [PATCH 06/26] mailinfo: always pass "line" as an argument Junio C Hamano
2015-10-14 20:22   ` Stefan Beller
2015-10-14 20:27     ` Junio C Hamano
2015-10-13 23:16 ` [PATCH 07/26] mailinfo: move global "line" into mailinfo() function Junio C Hamano
2015-10-14 20:27   ` Stefan Beller
2015-10-13 23:16 ` [PATCH 08/26] mailinfo: introduce "struct mailinfo" to hold globals Junio C Hamano
2015-10-13 23:16 ` [PATCH 09/26] mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo Junio C Hamano
2015-10-13 23:16 ` [PATCH 10/26] mailinfo: move global "FILE *fin, *fout" " Junio C Hamano
2015-10-13 23:16 ` [PATCH 11/26] mailinfo: move filter/header stage " Junio C Hamano
2015-10-13 23:16 ` [PATCH 12/26] mailinfo: move patch_lines " Junio C Hamano
2015-10-13 23:16 ` [PATCH 13/26] mailinfo: move add_message_id and message_id " Junio C Hamano
2015-10-13 23:16 ` [PATCH 14/26] mailinfo: move use_scissors and use_inbody_headers " Junio C Hamano
2015-10-13 23:16 ` [PATCH 15/26] mailinfo: move metainfo_charset " Junio C Hamano
2015-10-13 23:16 ` [PATCH 16/26] mailinfo: move transfer_encoding " Junio C Hamano
2015-10-13 23:16 ` [PATCH 17/26] mailinfo: move charset " Junio C Hamano
2015-10-13 23:16 ` [PATCH 18/26] mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak Junio C Hamano
2015-10-13 23:16 ` [PATCH 19/26] mailinfo: move cmitmsg and patchfile to struct mailinfo Junio C Hamano
2015-10-14  1:37   ` [PATCH 27/26] mailinfo: close patchfile Junio C Hamano
2015-10-14  1:46     ` [PATCH 28/26] am: make direct call to mailinfo Junio C Hamano
2015-10-13 23:16 ` [PATCH 20/26] mailinfo: move [ps]_hdr_data to struct mailinfo Junio C Hamano
2015-10-13 23:16 ` [PATCH 21/26] mailinfo: keep the parsed log message in a strbuf Junio C Hamano
2015-10-13 23:16 ` [PATCH 22/26] mailinfo: move content/content_top to struct mailinfo Junio C Hamano
2015-10-13 23:16 ` [PATCH 23/26] mailinfo: handle errors found in decode_header() better Junio C Hamano
2015-10-13 23:16 ` [PATCH 24/26] mailinfo: handle charset conversion errors in the caller Junio C Hamano
2015-10-13 23:16 ` [PATCH 25/26] mailinfo: remove calls to exit() and die() deep in the callchain Junio C Hamano
2015-10-13 23:16 ` [PATCH 26/26] mailinfo: libify the whole thing Junio C Hamano
2015-10-14 20:45 ` [PATCH v2 00/31] libify mailinfo and call it directly from am Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 01/31] mailinfo: remove a no-op call convert_to_utf8(it, "") Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 02/31] mailinfo: fix for off-by-one error in boundary stack Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 03/31] mailinfo: explicitly close file handle to the patch output Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 04/31] mailinfo: fold decode_header_bq() into decode_header() Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 05/31] mailinfo: move handle_boundary() lower Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 06/31] mailinfo: get rid of function-local static states Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 07/31] mailinfo: always pass "line" as an argument Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 08/31] mailinfo: move global "line" into mailinfo() function Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 09/31] mailinfo: introduce "struct mailinfo" to hold globals Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 10/31] mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 11/31] mailinfo: move global "FILE *fin, *fout" " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 12/31] mailinfo: move filter/header stage " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 13/31] mailinfo: move patch_lines " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 14/31] mailinfo: move add_message_id and message_id " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 15/31] mailinfo: move use_scissors and use_inbody_headers " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 16/31] mailinfo: move metainfo_charset " Junio C Hamano
2015-10-15 20:47     ` Eric Sunshine
2015-10-14 20:45   ` [PATCH v2 17/31] mailinfo: move transfer_encoding " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 18/31] mailinfo: move charset " Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 19/31] mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 20/31] mailinfo: move cmitmsg and patchfile to struct mailinfo Junio C Hamano
2015-10-14 22:55     ` Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 21/31] mailinfo: move [ps]_hdr_data " Junio C Hamano
2015-10-14 22:57     ` Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 22/31] mailinfo: keep the parsed log message in a strbuf Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 23/31] mailinfo: move content/content_top to struct mailinfo Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 24/31] mailinfo: move read_one_header_line() closer to its callers Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 25/31] mailinfo: move check_header() after the helpers it uses Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 26/31] mailinfo: move cleanup_space() before its users Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 27/31] mailinfo: move definition of MAX_HDR_PARSED to closer to its use Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 28/31] mailinfo: libify Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 29/31] mailinfo: handle charset conversion errors in the caller Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 30/31] mailinfo: remove calls to exit() and die() deep in the callchain Junio C Hamano
2015-10-14 20:45   ` [PATCH v2 31/31] am: make direct call to mailinfo Junio C Hamano
2015-10-19  7:28   ` [PATCH v3 00/34] libify mailinfo and call it directly from am Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 01/34] mailinfo: remove a no-op call convert_to_utf8(it, "") Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 02/34] mailinfo: fold decode_header_bq() into decode_header() Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 03/34] mailinfo: fix an off-by-one error in the boundary stack Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 04/34] mailinfo: explicitly close file handle to the patch output Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 05/34] mailinfo: move handle_boundary() lower Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 06/34] mailinfo: get rid of function-local static states Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 07/34] mailinfo: do not let handle_body() touch global "line" directly Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 08/34] mailinfo: do not let handle_boundary() " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 09/34] mailinfo: do not let find_boundary() " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 10/34] mailinfo: move global "line" into mailinfo() function Junio C Hamano
2015-10-19 22:57       ` Eric Sunshine
2015-10-20  5:19         ` Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 11/34] mailinfo: introduce "struct mailinfo" to hold globals Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 12/34] mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 13/34] mailinfo: move global "FILE *fin, *fout" " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 14/34] mailinfo: move filter/header stage " Junio C Hamano
2015-10-21 20:20       ` Stefan Beller
2015-10-19  7:28     ` [PATCH v3 15/34] mailinfo: move patch_lines " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 16/34] mailinfo: move add_message_id and message_id " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 17/34] mailinfo: move use_scissors and use_inbody_headers " Junio C Hamano
2015-10-21 20:24       ` Stefan Beller
2015-10-21 21:02         ` Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 18/34] mailinfo: move metainfo_charset " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 19/34] mailinfo: move check for metainfo_charset to convert_to_utf8() Junio C Hamano
2015-10-19 22:57       ` Eric Sunshine
2015-10-19  7:28     ` [PATCH v3 20/34] mailinfo: move transfer_encoding to struct mailinfo Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 21/34] mailinfo: move charset " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 22/34] mailinfo: move cmitmsg and patchfile " Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 23/34] mailinfo: move [ps]_hdr_data " Junio C Hamano
2015-10-21 20:30       ` Stefan Beller
2015-10-19  7:28     ` [PATCH v3 24/34] mailinfo: move content/content_top " Junio C Hamano
2015-10-21 20:36       ` Stefan Beller
2015-10-21 21:04         ` Junio C Hamano
2015-10-21 21:08           ` Stefan Beller
2015-10-19  7:28     ` [PATCH v3 25/34] mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 26/34] mailinfo: keep the parsed log message in a strbuf Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 27/34] mailinfo: move read_one_header_line() closer to its callers Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 28/34] mailinfo: move check_header() after the helpers it uses Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 29/34] mailinfo: move cleanup_space() before its users Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 30/34] mailinfo: move definition of MAX_HDR_PARSED closer to its use Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 31/34] mailinfo: libify Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 32/34] mailinfo: handle charset conversion errors in the caller Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 33/34] mailinfo: remove calls to exit() and die() deep in the callchain Junio C Hamano
2015-10-19  7:28     ` [PATCH v3 34/34] am: make direct call to mailinfo Junio C Hamano
2015-10-20 21:24     ` [PATCH v3 00/34] libify mailinfo and call it directly from am Junio C Hamano
2015-10-20 22:01       ` Stefan Beller
2015-10-20 22:06         ` Junio C Hamano
2015-10-20 22:08           ` Stefan Beller
2015-10-21 15:51       ` Ramsay Jones [this message]
2015-10-21 20:04         ` Johannes Sixt
2015-10-21 20:07           ` Junio C Hamano
2015-10-26 14:25           ` Johannes Schindelin
2015-10-26 18:42             ` Junio C Hamano
2015-10-21 23:15     ` [PATCH v4 00/35] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5627B496.7030102@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).