]>
git.ipfire.org Git - thirdparty/coreutils.git/commit
sort: avoid pthread calls with --parallel=1
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.