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

Re: Shell script cleanups/style changes?

From
David Kastrup <dak@gnu.org>
Date
Aug 3, 2007, 08:41 UTC
Message-ID
<86tzrhhuxg.fsf@lola.quinscape.zz>
In-Reply-To
<7v3az1oyjn.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> David Kastrup <dak@gnu.org> writes:
>
>> Ok, seems like the sort of cleanups I proposed would not clash with
>> current git policies.  I'll readily agree that the timing of their
>> adoption might not really fit with a rc4, but posting them for the
>> queue does not seem outrageous.
>
> Yeah, except that Kristian's C-rewrite of git-commit.sh may well
> jump the queue before such a patch would touch the file it
> intends to replace...

Well, since the work has already been done, I guess I might as well post it.

With regard to C rewrites: I would hazard a guess that git's performance might actually be improved by splitting some primitives into even smaller C building blocks and tying them all together with pipes (which makes shell scripts a natural container). As long as one designs the C chunks carefully enough that no bulk processing is done in the scripts themselves, this could actually lead to better schedulable pieces of software. I think that most index processing can be done in a list-merge style on sorted lists. That implies pipes and files on input and output, and a small memory footprint. With a good scheduler (the current Linux scheduler sucks at exploiting the asynchronicity of pipes; this should be better with CFS), this should make things work rather efficiently, be flexible for extension, and make good use of multi-core systems.

We have seen a recent example on this list: hand-chaining git-ls-files and a few other tools into a pipeline beat the pants off builtin-add.c.

Given that portability goes down the drain if we want to use similarly or more efficient constellations in C (multithreading and asynchronous I/O come to mind), I would not replace shell scripts (and the associated flexibility in extending functionality) lightly right now. As long as the main data flow is only managed rather than processed by the scripts, I think we would have more to gain by restructuring into pipelineable pieces. It will still be possible to ultimately tie those together in a single process image (with multiple threads presumably). But that immediately takes away a lot of flexibility.

-- 
David Kastrup
Previous: Junio C HamanoNext: David Kastrup
Message 27 of 42 in “Shell script cleanups/style changes?”
  1. David KastrupAug 2, 2007
  2. Robert SchieleAug 2, 2007
  3. David KastrupAug 2, 2007
  4. Robert SchieleAug 2, 2007
  5. Johannes SchindelinAug 2, 2007
  6. Robert SchieleAug 2, 2007
  7. Uwe Kleine-KönigAug 3, 2007
  8. Bradford SmithAug 2, 2007
  9. Sam RavnborgAug 2, 2007
  10. Junio C HamanoAug 2, 2007
  11. Nguyen Thai Ngoc DuyAug 2, 2007
  12. David KastrupAug 2, 2007
  13. Junio C HamanoAug 2, 2007
  14. David KastrupAug 2, 2007
  15. Junio C HamanoAug 2, 2007
  16. Junio C HamanoAug 2, 2007
  17. David KastrupAug 2, 2007
  18. Robert SchieleAug 2, 2007
  19. David KastrupAug 2, 2007
  20. Junio C HamanoAug 2, 2007
  21. David KastrupAug 2, 2007
  22. Junio C HamanoAug 3, 2007
  23. David KastrupAug 3, 2007
  24. Junio C HamanoAug 3, 2007
  25. David KastrupAug 3, 2007
  26. Junio C HamanoAug 3, 2007
  27. David KastrupAug 3, 2007
  28. David KastrupAug 3, 2007
  29. Robert SchieleAug 3, 2007
  30. David KastrupAug 3, 2007
  31. Robert SchieleAug 2, 2007
  32. David KastrupAug 2, 2007
  33. Robert SchieleAug 2, 2007
  34. David KastrupAug 2, 2007
  35. Robert SchieleAug 3, 2007
  36. David KastrupAug 3, 2007
  37. Junio C HamanoAug 3, 2007
  38. Robert SchieleAug 2, 2007
  39. Florian WeimerAug 4, 2007
  40. Robert SchieleAug 4, 2007
  41. Junio C HamanoAug 4, 2007
  42. David KastrupAug 2, 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.