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

Re: [PATCH v4 00/10] The final building block for a faster rebase -i

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 30, 2017, 15:44 UTC
Message-ID
<alpine.DEB.2.21.1.1705301635440.3610@virtualbox>
In-Reply-To
<CACBZZX4avOKJjWVSBSewNFMWyRj3FzHC2Onw3aWLf1F_MYi+Gg@mail.gmail.com>
Hi Ævar,
On Mon, 29 May 2017, Ævar Arnfjörð Bjarmason wrote:
Show 26 quoted lines
> On Mon, May 29, 2017 at 12:51 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Sat, 27 May 2017, René Scharfe wrote:
> >> Am 26.05.2017 um 05:15 schrieb Liam Beguin:
> >> > I tried to time the execution on an interactive rebase (on Linux)
> >> > but I did not notice a significant change in speed.  Do we have a
> >> > way to measure performance / speed changes between version?
> >>
> >> Well, there's performance test script p3404-rebase-interactive.sh.
> >> You could run it e.g. like this:
> >>
> >>       $ (cd t/perf && ./run origin/master HEAD ./p3404*.sh)
> >>
> >> This would compare the performance of master with the current branch
> >> you're on.  The results of p3404 are quite noisy for me on master,
> >> though (saw 15% difference between runs without any code changes), so
> >> take them with a bag of salt.
> >
> > Indeed. Our performance tests are simply not very meaningful.
> >
> > Part of it is the use of shell scripting (which defeats performance
> > testing pretty well),
> 
> Don't the performance tests take long enough that the shellscripting
> overhead gets lost in the noise?

Okay, here you go, my weekly (or so) clarification about the POSIX emulation layer called MSYS2 (which itself kind of a portable Cygwin).

Whenever Git for Windows has to execute Unix shell scripts (which are not native to Windows, as the "Unix" in "Unix shell scripts" so clearly suggests), we resort to calling the Bash from the MSYS2 project, which spins up a POSIX emulation layer. Git for Windows' own .exe files (and in particular, git.exe) is *not* affected by the POSIX emulation layer, as they are real Win32 programs.

Whenever execution has to bridge into, or out of, the POSIX emulation layer, a few things need to be done. To emulate signal handling, for example, a completely new process has to be spun up that itself has the non-MSYS2 process as a child. The environment has to be converted, to reflect the fact that some things are Unix-y paths (or path lists) inside the POSIX emulation layer and Windows paths outside.

Even when staying within the POSIX emulation layer, some operations are not as cheap as "Linux folks" are used to. For example, to spawn a subshell, due to the absence of a spawn syscall fork() is called, followed by exec(). However, fork() itself is not native to Windows and has to be emulated. The POSIX emulation layer spins up a new process, meticulously copies the entire memory, tries to reopen the file descriptors, network connections, etc (to emulate the fork() semantics).

Obviously, this is anything but cheap.

And this is only a glimpse into the entire problem, as I am not aware of any thorough analysis what is going on in msys-2.0.dll when shell scripts run. All I know is that it slows things down dramatically.

As a consequence, even the simple act of creating a repository, or spawning Win32 processes from within a shell, become quite the contributing factors to the noise of the measurements.

> E.g. on Windows what do you get when you run this in t/perf:
> 
>     $ GIT_PERF_REPEAT_COUNT=3 GIT_PERF_MAKE_OPTS="-j6 NO_OPENSSL=Y
> BLK_SHA1=Y CFLAGS=-O3" ./run v2.10.0 v2.12.0 v2.13.0 p3400-rebase.sh

In my hands, a repeat count of 3 always resulted in quite a bit of noise previously.

Mind you, I am working my machine. It has to run two VMs in the background, has multiple browsers and dozens of tabs open, checks for mails and Tweets and RSS feeds and a couple of Skypes are open, too.

So yeah, obviously there is a bit of noise involved.
> I get split-index performance improving by 28% in 2.12 and 58% in
> 2.13, small error bars even with just 3 runs. This is on Linux, but my
> sense of fork overhead on Windows is that it isn't so bad as to matter
> here.

Test ------------------------------------------------------ 3400.2: rebase on top of a lot of unrelated changes

v2.10.0 v2.12.0 v2.13.0 ------------------------------------------------------------------ 60.65(0.01+0.03) 55.75(0.01+0.07) -8.1% 55.97(0.04+0.09) -7.7%

(wrapped myself, as the ./run output is a lot wider than the 80 columns allowed in plain text email format)

And what does it tell you?

Not much, right? You have no idea about the trend line of the three tests, not even of the standard deviation (not that it would be meaningful for N=3). It is not immediately obvious whether the first run is always a tad slower (or faster), or whether there is no noticable difference between the first and any subsequent runs.

In other words, there is no measure of confidence in those results. We can't say how reliable those numbers are.

And we certainly can't know how much the shell scripting hurts.

Although... let's try something. Let's run the same command in a *Linux VM* on the same machine! Yes, that should give us an idea. So here goes:

Test ------------------------------------------------------ 3400.2: rebase on top of a lot of unrelated changes

v2.10.0 v2.12.0 v2.13.0 --------------------------------------------------------------- 2.08(1.76+0.15) 2.10(1.76+0.15) +1.0% 2.00(1.65+0.15) -3.8%

A ha! Not only does this show a curious *increase* in v2.12.0 (but I'd not put much stock into that, again N=3 is way too low a repetition number), it also shows that the Linux VM runs the same thing roughly 30x faster.

I did see a few speed differences between native git.exe on Windows and the git executable on Linux, but it was barely in the two-digit *percentage* region. Nowhere near the four-digit percentage region.

So now you know how much shell scripting hurts performance testing.
A lot.

It pretty much renders the entire endeavor of testing performance completely and utterly useless.

> I'd also be interested to see what sort of results you get for my
> "grep: add support for the PCRE v1 JIT API" patch which is in pu now,
> assuming you have a PCRE newer than 8.32 or so.
pu does not build for me:

2017-05-30T11:38:50.0089681Z libgit.a(grep.o): In function `pcre1match': 2017-05-30T11:38:50.0289250Z .../grep.c:411: undefined reference to `__imp_pcre_jit_exec' 2017-05-30T11:38:50.0329160Z collect2.exe: error: ld returned 1 exit status

Show 7 quoted lines
> > Frankly, I have no illusion about this getting fixed, ever.
> 
> I have a project on my TODO that I've been meaning to get to which
> would address this. I'd be interested to know what people think about
> the design:
> 
> * Run the perf tests in some more where the raw runtimes are saved away

You mean a test helper designed to do the timing and the setting up so as to time *just* the operations that should be timed?

If so: I am all for it.
> * Have some way to dump a static html page from that with graphs over
> time (with gnuplot svg?)

If you already go HTML, it would make much more sense to go d3.js. I would even prefer to go c3.js (which uses d3.js) right away. Would make everything so much easier.

Not to mention more portable.
> * Supply some config file to drive this, so you can e.g. run each
> tests N times against your repo X for the last 10 versions of git.
Sure.
> * Since it's static HTML it would be trivial for anyone to share such
> results, and e.g. setup running them in cron to regularly publish to
> github pages.

It does not need to be static. It can use, say, c3.js, for the added benefit of being able to toggle multiple graphs in the same diagram.

Ciao, Dscho

Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 96 of 100 in “The final building block for a faster rebase -i”
  1. 0/9 The final building block for a faster rebase -iJohannes Schindelin, Sep 2, 2016
  2. 1/9 rebase -i: generate the script via rebase--helperJohannes Schindelin, Sep 2, 2016
  3. 2/9 rebase -i: remove useless indentationJohannes Schindelin, Sep 2, 2016
  4. 3/9 rebase -i: do not invent onelines when expanding/collapsing SHA-1sJohannes Schindelin, Sep 2, 2016
  5. 4/9 rebase -i: also expand/collapse the SHA-1s via the rebase--helperJohannes Schindelin, Sep 2, 2016
  6. Dennis KaarsemakerSep 2, 2016
  7. Johannes SchindelinSep 3, 2016
  8. 5/9 t3404: relax rebase.missingCommitsCheck testsJohannes Schindelin, Sep 2, 2016
  9. 6/9 rebase -i: check for missing commits in the rebase--helperJohannes Schindelin, Sep 2, 2016
  10. Dennis KaarsemakerSep 2, 2016
  11. 8/9 t3415: test fixup with wrapped onelineJohannes Schindelin, Sep 2, 2016
  12. 7/9 rebase -i: skip unnecessary picks using the rebase--helperJohannes Schindelin, Sep 2, 2016
  13. 9/9 rebase -i: rearrange fixup/squash lines using the rebase--helperJohannes Schindelin, Sep 2, 2016
  14. Josh TriplettSep 3, 2016
  15. Johannes SchindelinSep 4, 2016
  16. 0/9 The final building block for a faster rebase -iJohannes Schindelin, Apr 25, 2017
  17. 3/9 rebase -i: do not invent onelines when expanding/collapsing SHA-1sJohannes Schindelin, Apr 25, 2017
  18. 1/9 rebase -i: generate the script via rebase--helperJohannes Schindelin, Apr 25, 2017
  19. Jeff KingApr 26, 2017
  20. Johannes SchindelinApr 26, 2017
  21. 2/9 rebase -i: remove useless indentationJohannes Schindelin, Apr 25, 2017
  22. 5/9 t3404: relax rebase.missingCommitsCheck testsJohannes Schindelin, Apr 25, 2017
  23. 4/9 rebase -i: also expand/collapse the SHA-1s via the rebase--helperJohannes Schindelin, Apr 25, 2017
  24. 8/9 t3415: test fixup with wrapped onelineJohannes Schindelin, Apr 25, 2017
  25. 6/9 rebase -i: check for missing commits in the rebase--helperJohannes Schindelin, Apr 25, 2017
  26. 9/9 rebase -i: rearrange fixup/squash lines using the rebase--helperJohannes Schindelin, Apr 25, 2017
  27. 7/9 rebase -i: skip unnecessary picks using the rebase--helperJohannes Schindelin, Apr 25, 2017
  28. Jeff KingApr 26, 2017
  29. Johannes SchindelinApr 26, 2017
  30. Junio C HamanoApr 26, 2017
  31. 0/9 The final building block for a faster rebase -iJohannes Schindelin, Apr 26, 2017
  32. 1/9 rebase -i: generate the script via rebase--helperJohannes Schindelin, Apr 26, 2017
  33. Junio C HamanoApr 27, 2017
  34. Johannes SchindelinApr 27, 2017
  35. Junio C HamanoApr 28, 2017
  36. Junio C HamanoApr 28, 2017
  37. Johannes SchindelinApr 28, 2017
  38. Junio C HamanoMay 1, 2017
  39. Johannes SchindelinMay 1, 2017
  40. Phillip WoodApr 28, 2017
  41. Johannes SchindelinApr 28, 2017
  42. Phillip WoodMay 1, 2017
  43. Johannes SchindelinMay 1, 2017
  44. Junio C HamanoMay 1, 2017
  45. Johannes SchindelinMay 1, 2017
  46. 2/9 rebase -i: remove useless indentationJohannes Schindelin, Apr 26, 2017
  47. 3/9 rebase -i: do not invent onelines when expanding/collapsing SHA-1sJohannes Schindelin, Apr 26, 2017
  48. 5/9 t3404: relax rebase.missingCommitsCheck testsJohannes Schindelin, Apr 26, 2017
  49. Junio C HamanoApr 27, 2017
  50. Johannes SchindelinApr 27, 2017
  51. 4/9 rebase -i: also expand/collapse the SHA-1s via the rebase--helperJohannes Schindelin, Apr 26, 2017
  52. Junio C HamanoApr 27, 2017
  53. Junio C HamanoApr 27, 2017
  54. Johannes SchindelinApr 27, 2017
  55. Junio C HamanoApr 28, 2017
  56. Johannes SchindelinApr 28, 2017
  57. 6/9 rebase -i: check for missing commits in the rebase--helperJohannes Schindelin, Apr 26, 2017
  58. Junio C HamanoApr 27, 2017
  59. Johannes SchindelinApr 28, 2017
  60. 7/9 rebase -i: skip unnecessary picks using the rebase--helperJohannes Schindelin, Apr 26, 2017
  61. 8/9 t3415: test fixup with wrapped onelineJohannes Schindelin, Apr 26, 2017
  62. 9/9 rebase -i: rearrange fixup/squash lines using the rebase--helperJohannes Schindelin, Apr 26, 2017
  63. 00/10 The final building block for a faster rebase -iJohannes Schindelin, Apr 28, 2017
  64. 01/10 t3415: verify that an empty instructionFormat is handled as beforeJohannes Schindelin, Apr 28, 2017
  65. 02/10 rebase -i: generate the script via rebase--helperJohannes Schindelin, Apr 28, 2017
  66. 02/10 rebase -i: generate the script via rebase--helperLiam Beguin, May 26, 2017
  67. Johannes SchindelinMay 29, 2017
  68. liam BeguinMay 30, 2017
  69. liam BeguinMay 30, 2017
  70. Junio C HamanoMay 29, 2017
  71. Johannes SchindelinMay 29, 2017
  72. Junio C HamanoMay 30, 2017
  73. Johannes SchindelinMay 30, 2017
  74. revision API design, was Re: [PATCH v4 02/10] rebase -i: generate the script via rebase--helperJohannes Schindelin, May 30, 2017
  75. Junio C HamanoMay 30, 2017
  76. Junio C HamanoJun 1, 2017
  77. 03/10 rebase -i: remove useless indentationJohannes Schindelin, Apr 28, 2017
  78. 03/10 rebase -i: remove useless indentationLiam Beguin, May 26, 2017
  79. Stefan BellerMay 26, 2017
  80. liam BeguinMay 27, 2017
  81. 04/10 rebase -i: do not invent onelines when expanding/collapsing SHA-1sJohannes Schindelin, Apr 28, 2017
  82. 05/10 rebase -i: also expand/collapse the SHA-1s via the rebase--helperJohannes Schindelin, Apr 28, 2017
  83. 05/10 rebase -i: also expand/collapse the SHA-1s via the rebase--helperLiam Beguin, May 26, 2017
  84. Johannes SchindelinMay 29, 2017
  85. 06/10 t3404: relax rebase.missingCommitsCheck testsJohannes Schindelin, Apr 28, 2017
  86. 07/10 rebase -i: check for missing commits in the rebase--helperJohannes Schindelin, Apr 28, 2017
  87. 08/10 rebase -i: skip unnecessary picks using the rebase--helperJohannes Schindelin, Apr 28, 2017
  88. 09/10 t3415: test fixup with wrapped onelineJohannes Schindelin, Apr 28, 2017
  89. 10/10 rebase -i: rearrange fixup/squash lines using the rebase--helperJohannes Schindelin, Apr 28, 2017
  90. 10/10 rebase -i: rearrange fixup/squash lines using the rebase--helperLiam Beguin, May 26, 2017
  91. Johannes SchindelinMay 29, 2017
  92. 00/10 The final building block for a faster rebase -iLiam Beguin, May 26, 2017
  93. René ScharfeMay 27, 2017
  94. Johannes SchindelinMay 29, 2017
  95. Ævar Arnfjörð BjarmasonMay 29, 2017
  96. Johannes SchindelinMay 30, 2017
  97. Ævar Arnfjörð BjarmasonMay 30, 2017
  98. Ævar Arnfjörð BjarmasonMay 31, 2017
  99. Johannes SchindelinMay 29, 2017
  100. Junio C HamanoMay 29, 2017

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.