Pádraig Brady <[email protected]> writes: > Before this change there were the following unneeded pthread calls: > > $ seq 1e6 | ltrace -c -e 'pthread*' sort --parallel=1 | wc -l > % time seconds usecs/call calls function > ------ ----------- ----------- --------- -------------------- > 39.13 0.031757 67 468 pthread_mutex_lock > 37.96 0.030811 65 468 pthread_mutex_unlock > 13.17 0.010691 65 162 pthread_cond_signal > 2.15 0.001747 64 27 pthread_mutex_destroy > 2.00 0.001620 60 27 pthread_mutex_init > 0.70 0.000565 62 9 pthread_cond_destroy > 0.64 0.000518 57 9 pthread_cond_init > ------ ----------- ----------- --------- -------------------- > 100.00 0.081159 1170 total > > * src/sort.c (sort): Avoid merge tree overhead when single threaded. > --- > src/sort.c | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-)
Cool, I didn't know about 'ltrace'. Looks good. I had a look at removing some of the other "if (1 < nthreads)" checks, but they are all needed for recursive calls. Collin
