aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-11-26 15:17:59 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2014-11-26 15:17:59 +0100
commit04c14176023c65550fd46c2e44a1aa04d426d69a (patch)
tree71ac5af09a5303ba891b28bc879a10e1da92c6dc /libbb
parent2835a224cd603489ac08625265d383d4690cb58a (diff)
downloadbusybox-04c14176023c65550fd46c2e44a1aa04d426d69a.tar.gz
libbb: use ARG_MAX for bb_arg_max() only if it's 60k+
Sometimes ARG_MAX is small (like 32k) yet sysconf(_SC_ARG_MAX) is big, and people prefer using the bigger value. OTOH, with sufficiently large ARG_MAX, further wins from sysconf(_SC_ARG_MAX) being bigger are exponentially smaller: you can see 4 times fewer fork+execs when you run find, but when each execed process already takes a thousand parameters it's likely execution time is dominated by what that process does with each parameter. Thus, with this change ARG_MAX is used if it's sufficiently big, otherwise sysconf(_SC_ARG_MAX) is used. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/sysconf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/sysconf.c b/libbb/sysconf.c
index 031901980..cfad9cdc0 100644
--- a/libbb/sysconf.c
+++ b/libbb/sysconf.c
@@ -8,7 +8,7 @@
*/
#include "libbb.h"
-#if !defined(ARG_MAX) && defined(_SC_ARG_MAX)
+#if !defined(bb_arg_max)
unsigned FAST_FUNC bb_arg_max(void)
{
return sysconf(_SC_ARG_MAX);