OSDN Git Service

grep: allow threading even on a single-core machine
authorVictor Leschuk <vleschuk@gmail.com>
Tue, 15 Dec 2015 15:31:39 +0000 (18:31 +0300)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Dec 2015 18:43:30 +0000 (10:43 -0800)
Earlier we disabled threading when online_cpus() said "1", but on a
filesystem with long latency (or in a cold cache situation), using
multiple threads to drive I/O in parallel would improve performance
even on a single-core machines.

Signed-off-by: Victor Leschuk <vleschuk@accesssoftek.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c

index d04f440..734d6ce 100644 (file)
@@ -832,7 +832,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        }
 
 #ifndef NO_PTHREADS
-       if (list.nr || cached || online_cpus() == 1)
+       if (list.nr || cached)
                use_threads = 0;
 #else
        use_threads = 0;