From: Victor Leschuk <vleschuk@gmail.com>
To: git@vger.kernel.org
Cc: vleschuk@accesssoftek.com, gitster@pobox.com, john@keeping.me.uk,
peff@peff.net, pclouds@gmail.com, sunshine@sunshineco.com
Subject: [PATCH 2/2] Get rid of online_cpus() when determining grep threads num
Date: Tue, 15 Dec 2015 18:31:40 +0300 [thread overview]
Message-ID: <1450193500-22468-3-git-send-email-vleschuk@accesssoftek.com> (raw)
In-Reply-To: <1450193500-22468-1-git-send-email-vleschuk@accesssoftek.com>
Number of threads now doesn't depend on online_cpus(),
e.g. if specific number is not configured GREP_NUM_THREADS_DEFAULT (8)
threads will be used even on 1-core CPU.
Reason: multithreading can improve performance even on single core machines
as IO is also a major factor here. Using multiple threads can significantly
boost grep performance when working on slow filesystems (or repo isn't cached)
or through network (for example repo is located on NFS).
Signed-off-by: Victor Leschuk <vleschuk@accesssoftek.com>
---
builtin/grep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index e9aebab..1315905 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -827,7 +827,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
}
#ifndef NO_PTHREADS
- if (list.nr || cached || online_cpus() == 1 || show_in_pager) {
+ if (list.nr || cached || show_in_pager) {
/* Can not multi-thread object lookup */
num_threads = 0;
}
--
2.6.3.369.g3e7f205.dirty
prev parent reply other threads:[~2015-12-15 15:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 15:31 [PATCH v8 0/2] Add git-grep threads param Victor Leschuk
2015-12-15 15:31 ` [PATCH 1/2] Introduce grep " Victor Leschuk
2015-12-15 20:06 ` Junio C Hamano
2015-12-15 20:21 ` Victor Leschuk
2015-12-16 0:26 ` Eric Sunshine
2015-12-15 15:31 ` Victor Leschuk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450193500-22468-3-git-send-email-vleschuk@accesssoftek.com \
--to=vleschuk@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=john@keeping.me.uk \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
--cc=vleschuk@accesssoftek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).