Am 07.12.2011 05:24, schrieb Jeff King: > On Tue, Dec 06, 2011 at 11:48:26PM +0100, René Scharfe wrote: > >> #ifndef NO_PTHREADS >> - if (use_threads) { >> + if (nr_threads > 0) { >> grep_sha1_async(opt, name, sha1); >> return 0; >> } else > > Should this be "if (nr_threads > 1)"? > > As a user, I would do: > > git grep --threads=1 ... > > if I wanted a single-threaded process. Instead, we actually spawn a > sub-thread and do all of the locking, which has a measurable cost: Yes, the difference is measurable, and that's exactly how I like it to be. :) A user can turn off threading with --threads=0 or (more intuitively) --no-threads. And we can quantify the overhead. > $ time git grep --threads=0 SIMPLE HEAD >/dev/null > real 0m2.994s > user 0m2.932s > sys 0m0.060s > > $ time git grep --threads=1 SIMPLE HEAD >/dev/null > real 0m3.407s > user 0m3.392s > sys 0m0.140s > > Should --threads=1 be equivalent to --threads=0? We can do that if there's another way to calculate this difference, or if it is not useful to know. I find your results interesting at least, though. :) René -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html