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

Re: scripting speedups [was: [Summit topic] Crazy (and not so crazy) ideas]

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 2, 2021, 13:52 UTC
Message-ID
<nycvar.QRO.7.76.6.2111021446140.56@tvgsbejvaqbjf.bet>
In-Reply-To
<20211026201448.GA29480@dcvr>
Hi Eric,
On Tue, 26 Oct 2021, Eric Wong wrote:
Show 14 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > * Test suite is slow. Shell scripts and process forking.
> >
> >    * What if we had a special shell that interpreted the commands in a
> >      single process?
> >
> >    * Even Git commands like rev-parse and hash-object, as long as that’s
> >      not the command you’re trying to test
>
> This is something I've wanted in a very long time as a scripter.
> fast-import has been great over the years, as is
> "cat-file --batch(-check)", but there's gaps should be filled
> (preferably without fragile linkage of shared libraries into a
> script process)

The conclusion reached at the Summit seemed to be that we don't want to get into that rabbit hole. We might very well end up maintaining a POSIX-compatible shell inside Git. Definitely out of scope.

Show 11 quoted lines
> >    * Dscho wants to slip in a C-based solution
> >
> >    * Jonathan tan commented: going back to your custom shell for tests
> >      idea, one thing we could do is have a custom command that generates
> >      the repo commits that we want (and that saves process spawns and
> >      might make the tests simpler too)
>
> Perhaps a not-seriously-proposed patch from 2006 could be
> modernized for our now-libified internals:
>
> https://yhbt.net/lore/git/Pine.LNX.4.64.0602232229340.3771@g5.osdl.org/

Thanks for digging that out. I had looked for it multiple times over the years, but searched using the wrong search terms.

However, as you can see, it went nowhere. Probably the (implicit) conclusion was the same as above.

Show 7 quoted lines
> >       * We could replace several “setup repo” steps with “git fast-import”
> >         instead.
> >
> >    * Dscho measured: 0.5 sec - 30 sec in setup steps. Can use fast-import,
> >      or can make a new format that helps us set up the test scenario
>
> 0.5s - 30s across the whole suite or individual tests?

That was just vague recollection, but it was for setup steps, i.e. the initial test cases that do not even test Git's functionality but merely want to set up a repository/worktree for the subsequent test cases to play with.

> Having a way to disable fsync globally should further improve
> things, especially for people on slower storage.  libeatmydata
> is available, but perhaps not widely available/known.

What was missing from the notes was the crucial fact that I did this on Windows, i.e. a platform that is pretty darned good at multi-tasking (something with which Linux has historically struggled a bit), but not so good at spawning wholesale processes.

So the problem really is that calling, say, `git commit` in a `for $(test_seq 100)` loop is ridiculously expensive.

Even rewriting those setup test cases to something as verbose as a `fast-import` stream accelerates them like you wouldn't believe.

I even thought I threw out the idea of implementing a test helper that could turn the output of `git log --graph --oneline` into a branch replicating that structure, but it might have gotten lost in the noise.

I doubt that my test suite-centered commentary is very helpful for your use cases, though.

Ciao, Dscho

Previous: Junio C HamanoNext: Johannes Schindelin
Message 8 of 58 in “Notes from the Git Contributors' Summit 2021, virtual, Oct 19/20”
  1. Johannes SchindelinOct 21, 2021
  2. [Summit topic] Crazy (and not so crazy) ideasJohannes Schindelin, Oct 21, 2021
  3. Son Luong NgocOct 21, 2021
  4. scripting speedups [was: [Summit topic] Crazy (and not so crazy) ideas]Eric Wong, Oct 26, 2021
  5. Ævar Arnfjörð BjarmasonOct 30, 2021
  6. test suite speedups via some not-so-crazy ideas (was: scripting speedups[...])Ævar Arnfjörð Bjarmason, Nov 3, 2021
  7. Junio C HamanoNov 3, 2021
  8. Johannes SchindelinNov 2, 2021
  9. [Summit topic] SHA-256 UpdatesJohannes Schindelin, Oct 21, 2021
  10. [Summit topic] Server-side merge/rebase: needs and wants?Johannes Schindelin, Oct 21, 2021
  11. Bagas SanjayaOct 22, 2021
  12. Johannes SchindelinOct 22, 2021
  13. Ævar Arnfjörð BjarmasonOct 23, 2021
  14. Taylor BlauNov 8, 2021
  15. Ævar Arnfjörð BjarmasonNov 9, 2021
  16. Christian CouderNov 30, 2021
  17. [Summit topic] Submodules and how to make them worth usingJohannes Schindelin, Oct 21, 2021
  18. [Summit topic] Sparse checkout behavior and plansJohannes Schindelin, Oct 21, 2021
  19. [Summit topic] The state of getting a reftable backend working in git.gitJohannes Schindelin, Oct 21, 2021
  20. Han-Wen NienhuysOct 25, 2021
  21. Ævar Arnfjörð BjarmasonOct 25, 2021
  22. Han-Wen NienhuysOct 26, 2021
  23. Philip OakleyOct 28, 2021
  24. Philip OakleyOct 26, 2021
  25. [Summit topic] Documentation (translations, FAQ updates, new user-focused, general improvements, etc.)Johannes Schindelin, Oct 21, 2021
  26. Jean-Noël AvilaOct 22, 2021
  27. Ævar Arnfjörð BjarmasonOct 22, 2021
  28. Jean-Noël AvilaOct 27, 2021
  29. Jeff KingOct 27, 2021
  30. [Summit topic] Increasing diversity & inclusion (transition to `main`, etc)Johannes Schindelin, Oct 21, 2021
  31. Son Luong NgocOct 21, 2021
  32. vale check, was Re: [Summit topic] Increasing diversity & inclusion (transition to `main`, etc)Johannes Schindelin, Oct 22, 2021
  33. Johannes SchindelinOct 22, 2021
  34. [Summit topic] Improving Git UXJohannes Schindelin, Oct 21, 2021
  35. changing the experimental 'git switch' (was: [Summit topic] Improving Git UX)Ævar Arnfjörð Bjarmason, Oct 21, 2021
  36. Junio C HamanoOct 21, 2021
  37. Bagas SanjayaOct 22, 2021
  38. martinOct 22, 2021
  39. Ævar Arnfjörð BjarmasonOct 22, 2021
  40. Sergey OrganovOct 22, 2021
  41. martinOct 22, 2021
  42. Sergey OrganovOct 23, 2021
  43. MartinOct 24, 2021
  44. Junio C HamanoOct 24, 2021
  45. Ævar Arnfjörð BjarmasonOct 25, 2021
  46. Junio C HamanoOct 25, 2021
  47. Sergey OrganovOct 25, 2021
  48. Ævar Arnfjörð BjarmasonOct 25, 2021
  49. Sergey OrganovOct 27, 2021
  50. [Summit topic] Improving reviewer quality of life (patchwork, subsystem lists?, etc)Johannes Schindelin, Oct 21, 2021
  51. Konstantin RyabitsevOct 21, 2021
  52. Ævar Arnfjörð BjarmasonOct 22, 2021
  53. Missing notes, was Re: Notes from the Git Contributors' Summit 2021, virtual, Oct 19/20Johannes Schindelin, Oct 22, 2021
  54. Johannes SchindelinOct 22, 2021
  55. Johannes SchindelinOct 22, 2021
  56. Johannes SchindelinOct 22, 2021
  57. Let's have public Git chalk talks, was Re: Notes from the Git Contributors' Summit 2021, virtual, Oct 19/20Johannes Schindelin, Oct 22, 2021
  58. Ævar Arnfjörð BjarmasonOct 25, 2021

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.