{"thread":{"id":"22163","subject":"Re: [PATCH] Threaded grep (was: Re: [PATCH] grep: do not do external grep on skip-worktree entries)","startedAt":"2010-01-11T10:42:55Z","lastAt":"2010-01-11T10:42:55Z","messageCount":1,"participants":["Fredrik Kuivinen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"131282","messageId":"4c8ef71001110242m160a63a8wd0294c0f26373c2e@mail.gmail.com","threadId":"22163","inReplyTo":"alpine.LFD.2.00.1001080956270.7821@localhost.localdomain","subject":"Re: [PATCH] Threaded grep (was: Re: [PATCH] grep: do not do external grep on skip-worktree entries)","fromName":"Fredrik Kuivinen","fromEmail":"frekui@gmail.com","sentAt":"2010-01-11T10:42:55Z","receivedAt":"2010-01-11T10:42:55Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"[I messed up the Cc list when I sent the first mail in this thread, so\nit didn't reach git@vger. This time it's fixed for real. Sorry for the\nextra copy.]\n\nOn Fri, Jan 8, 2010 at 19:04, Linus Torvalds\n<torvalds@linux-foundation.org> wrote:\n>\n>\n> On Fri, 8 Jan 2010, Fredrik Kuivinen wrote:\n>>\n>> I only have access to a couple of boxes with more than one core so\n>> some more testing would be greatly appreciated. On the boxes I have\n>> tested this on the added parallelism roughly cut the time to grep the\n>> linux kernel in half (compared to the built-in grep). It also compares\n>> favourably to the external GNU grep (these are best of three runs):\n>\n> On my box (in all cases best-of-five):\n>\n>  - \"NO_THREADS=1 git grep --no-ext-grep qwerty\":\n>\n>        real    0m0.945s\n>        user    0m0.808s\n>        sys     0m0.128s\n>\n>  - \"git grep --no-ext-grep qwerty\":\n>\n>        real    0m0.402s\n>        user    0m1.116s\n>        sys     0m0.216s\n>\n>  - \"git grep qwerty\":\n>\n>        real    0m0.408s\n>        user    0m0.176s\n>        sys     0m0.152s\n>\n> so it _just_ beat the external grep thanks to using 330% CPU time. An\n> improvement, yes, but the CPU wastage is kind of sad. It really would be\n> nice to see if we could get rid of the stupid per-line overhead some way.\n\nI agree. The per-line thing seems to be fixed with Junios recent patch.\n\n> Btw, there does seem to be some unnecessary synchronization there, because\n> if I pick a pattern that has no matches at all, my best parallel number\n> goes down to 0.316. But the variation in times for the parallel one is so\n> big that I don't know how relevant that all is.\n>\n> I suspect you need more threads than CPU's due to the waiting (so that\n> other threads can pick up the slack when one thread ends up waiting to\n> output). Or don't wait at all, and queue it up instead.\n\nYes, you are right, there is some unnecessary synchronization. I am\nworking on a new patch which queues the output instead.\n\n- Fredrik\n"}]}