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

"git grep" parallelism question

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 26, 2013, 17:31 UTC
Message-ID
<CA+55aFxY2PJ+L=vCfvQ39UGBr7E6m5q76hO=z3Mqm6vTQmmMbw@mail.gmail.com>

Since I reboot fairly regularly to test new kernels, I don't *always* have the kernel source tree in my caches, so I still care about some cold-cache performance. And "git grep" tends to be the most noticeable one.

Now, I have a SSD, and even the cold-cache case takes just five seconds or so, but that's still somethng I react to, since the normal "kernel tree in cache" case ends up bring close enough to instantaneous (half a second) that then when it takes longer I react to it.

And I started thinking about it, and our "git grep" parallelism seems to be limited to 8.

Which is fine most of the time for CPU parallelism (although maybe some people with big machines would prefer higher numbers), but for IO parallelism I thought that maybe we'd like a higher number...

So I tried it out, and with THREADS set to 32, I get a roughly 15% performance boost for the cold-cache case (the error bar is high enough to not give a very precise number, but I see it going from ~4.8-4.9s on my machine down to 4.2..4.6s).

That's on an SSD, though - the performance implications might be very different for other use cases (NFS would likely prefer higher IO parallelism and might show bigger improvement, while a rotational disk might end up just thrashing more)

Is this a big deal? Probably not. But I did react to how annoying it was to set the parallelism factor (recompile git with a new number). Wouldn't it be lovely if it was slightly smarter (something more akin to the index preloading that takes number of files into account) or at least allowed people to set the parallelism explicitly with a command line switch?

Right now it disables the parallel grep entirely for UP, for example. Which makes perfect sense if grep is all about CPU use. But even UP might improve from parallel IO..

              Linus
Next: Junio C Hamano
Message 1 of 16 in “"git grep" parallelism question”
  1. Linus TorvaldsApr 26, 2013
  2. Junio C HamanoApr 26, 2013
  3. Linus TorvaldsApr 26, 2013
  4. Junio C HamanoApr 26, 2013
  5. Linus TorvaldsApr 26, 2013
  6. Thomas RastApr 27, 2013
  7. Ramkumar RamachandraApr 29, 2013
  8. John KeepingApr 29, 2013
  9. Thomas RastApr 29, 2013
  10. John KeepingApr 29, 2013
  11. Junio C HamanoApr 29, 2013
  12. John KeepingApr 30, 2013
  13. Jeff KingApr 30, 2013
  14. John KeepingApr 30, 2013
  15. Jeff KingApr 30, 2013
  16. Pete WyckoffMay 5, 2013

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.