From: Victor Leschuk Date: Mon, 09 Nov 2015 16:34:27 GMT Subject: RE: [PATCH v4] Add git-grep threads param Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE5D0FDABA17@mail.accesssoftek.com> In-Reply-To: <20151109155538.GC27224@sigill.intra.peff.net> > Why don't we leave it at 8, then? That's the conservative choice, and > once we have --threads, people can easily experiment with different > values and we can follow-up with a change to the default if need be. I'd propose the following: if (list.nr || cached) { num_threads = 0; /* Can not multi-thread object lookup */ } else if (num_threads < 0 && online_cpus() <= 1) { num_threads = 0; /* User didn't set threading option and we have <= 1 of hardware cores */ } else if (num_threads == 0) { num_threads = GREP_NUM_THREADS_DEFAULT; /* User explicitly choose default behavior */ } else if (num_threads < 0) { /* Actually this one should be checked earlier so no need to double check here */ die(_("Ivalid number of threads specified (%d)"), num_threads) } -- Victor