Re: [PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Stefan Beller
On Thu, Jun 1, 2017 at 2:55 PM, Ævar Arnfjörð Bjarmason wrote: > On Thu, Jun 1, 2017 at 11:45 PM, Stefan Beller wrote: >>> I didn't mean to change this bit, it should remain "if >>> (!num_threads)". I was in the middle of monkeypatching and didn't >>> review the diff carefully enough. But it any

Re: [PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Ævar Arnfjörð Bjarmason
On Thu, Jun 1, 2017 at 11:45 PM, Stefan Beller wrote: >> I didn't mean to change this bit, it should remain "if >> (!num_threads)". I was in the middle of monkeypatching and didn't >> review the diff carefully enough. But it any case, without this change >> the rest of this diff is your proposed (

Re: [PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Stefan Beller
> I didn't mean to change this bit, it should remain "if > (!num_threads)". I was in the middle of monkeypatching and didn't > review the diff carefully enough. But it any case, without this change > the rest of this diff is your proposed (but segfaulting) change as I > understand it. Sorry for th

Re: [PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Ævar Arnfjörð Bjarmason
On Thu, Jun 1, 2017 at 11:36 PM, Ævar Arnfjörð Bjarmason wrote: > On Thu, Jun 1, 2017 at 11:20 PM, Stefan Beller wrote: >> On Thu, Jun 1, 2017 at 11:20 AM, Ævar Arnfjörð Bjarmason >> wrote: >> >>> + if (num_threads == 1) >>> + num_threads = 0; >> >> I would think that it is e

Re: [PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Ævar Arnfjörð Bjarmason
On Thu, Jun 1, 2017 at 11:20 PM, Stefan Beller wrote: > On Thu, Jun 1, 2017 at 11:20 AM, Ævar Arnfjörð Bjarmason > wrote: > >> + if (num_threads == 1) >> + num_threads = 0; > > I would think that it is easier to maintain the code when keep the 1 > hard coded, and apply the fol

Re: [PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Stefan Beller
On Thu, Jun 1, 2017 at 11:20 AM, Ævar Arnfjörð Bjarmason wrote: > + if (num_threads == 1) > + num_threads = 0; I would think that it is easier to maintain the code when keep the 1 hard coded, and apply the following diff instead. If we encounter a 0 later on, it is not clear

[PATCH v4 2/8] grep: skip pthreads overhead when using one thread

2017-06-01 Thread Ævar Arnfjörð Bjarmason
Skip the administrative overhead of using pthreads when only using one thread. Instead take the non-threaded path which would be taken under NO_PTHREADS. The threading support was initially added in commit 5b594f457a ("Threaded grep", 2010-01-25) with a hardcoded compile-time number of 8 threads.