Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sat, 29 Jan 2005 10:39:57 +0100 From: Stepan Kasal To: autoconf-patches AT gnu DOT org, cygwin AT cygwin DOT com Subject: Re: _AS_DETECT_BETTER_SHELL speedup Message-ID: <20050129093957.GB24470@matsrv.math.cas.cz> Mail-Followup-To: autoconf-patches AT gnu DOT org References: <20050126174139 DOT GC27158 AT iam DOT uni-bonn DOT de> <20050127152131 DOT GB24060 AT matsrv DOT math DOT cas DOT cz> <20050127155540 DOT GA8770 AT iam DOT uni-bonn DOT de> <20050127160227 DOT GA8861 AT iam DOT uni-bonn DOT de> <20050127162908 DOT GB13327 AT matsrv DOT math DOT cas DOT cz> <87k6pydbfw DOT fsf AT penguin DOT cs DOT ucla DOT edu> <20050127174957 DOT GC12120 AT iam DOT uni-bonn DOT de> <87mzuu14oy DOT fsf AT penguin DOT cs DOT ucla DOT edu> <20050128091600 DOT GD13052 AT matsrv DOT math DOT cas DOT cz> <87zmytpb4d DOT fsf AT penguin DOT cs DOT ucla DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zmytpb4d.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.4.1i X-Virus-Status: Clean X-Spam-Status: No, hits=-1.4 required=5.0 tests=BAYES_20 autolearn=no version=2.64 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on matsrv.math.cas.cz Hello all, hello to the Cygwin folk, on the autoconf-patches, a patch was submitted which would replace occurences of (nonexistent) 2>/dev/null by { nonexistent; } 2>/dev/null Which would present a speedup of ./configure script, especially on Cygwin, where fork is really slow. Please note that mere "nonexistent 2>/dev/null" doesn't suffice, as some shells, eg. ash which is the /bin/sh on (some) *BSD systems, print the 'not found' message anyway. The above change avoids fork on many modern shells, yet is seems to prevent the 'not found' message. But there is still a risk that it will not prevent it on all existing shell flavours. Or even future shell flavours, as the unfortunate message apparently is not forbidden by POSIX. At this situation, Paul Eggert wrote: > If the configure script outputs random irrelevant messages to users > then that will cause real problems in practice. We get too many bug > reports already; I don't want to be bothered by bug reports about > bogus "not found" messages. I understand now that the price may be quite high, actually, if we are unlucky, ... > Let's see the actual measured performance numbers, for each proposed > change, on a modern Cygwin box. The first rule for optimization that > hurts code quality is to avoid it if it doesn't really improve things > much overall. ... so this resolution seems sensible. And this I why I'm writing to the Cygwin list. If you are intersted in this possible speedup, please do the following: - download current CVS autoconf, - measure the difference in the time taken by ./configure generated with and without the patch appended to this mail. If this patch presented a substantial speedup of ./configure on Cygwin, that would be a strong reason to accept it. So, Cygwin folk, it's your turn now. (This patch is Ralf's original patch, minus the parts which have been addressed by Paul's ``even more conservative patch''. Again. I have verified that make check passes on a modern GNU/Linux system.) Have a nice day, Stepan Kasal 2005-01-29 Ralf Wildenhues * Makefile.maint, lib/Autom4te/General.pm, lib/autoconf/fortran.m4, lib/autoconf/general.m4, lib/autoconf/libs.m4, lib/autoconf/status.m4, lib/autotest/general.m4, lib/m4sugar/m4sh.m4, tests/local.at: Replace all redirected subshells ( cmd ) > ... with { cmd; } > ..., whereever cmd has no side-effects on the current shell. Note that now cmd might be run within the current shell or within a subshell. Index: Makefile.maint =================================================================== RCS file: /cvsroot/autoconf/autoconf/Makefile.maint,v retrieving revision 1.28 diff -u -r1.28 Makefile.maint --- Makefile.maint 20 Aug 2004 23:47:48 -0000 1.28 +++ Makefile.maint 29 Jan 2005 08:56:01 -0000 @@ -112,7 +112,7 @@ exit 1; } || : sc_space_tab: - @( cvsu --list ) > /dev/null 2>&1 || : && \ + @{ cvsu --list; } > /dev/null 2>&1 || : && \ grep '[ ] ' \ $$(cvsu --list | grep -vEf .x-$@ ) && \ { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ @@ -170,14 +170,14 @@ # Get list of candidates with this: # grep -h include src/sys*.h|sed 's/.*include //'|sort - sc_system_h_headers: - @( cvsu --list ) > /dev/null 2>&1 || : && \ + @{ cvsu --list; } > /dev/null 2>&1 || : && \ grep -E '^# *include ["<]($(h_re))\.h[">]' \ $$(cvsu --list src | grep -Ev 'sys(2|tem)\.h$$') \ && { echo '$(ME): the above are already included via system.h'\ 1>&2; exit 1; } || : sc_sun_os_names: - @( cvsu --list ) > /dev/null 2>&1 || : && \ + @{ cvsu --list; } > /dev/null 2>&1 || : && \ grep -Ei \ 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ $$(cvsu --list | grep -vEf .x-$@ ) && \ Index: lib/Autom4te/General.pm =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/General.pm,v retrieving revision 1.33 diff -u -r1.33 General.pm --- lib/Autom4te/General.pm 12 Aug 2004 17:24:16 -0000 1.33 +++ lib/Autom4te/General.pm 29 Jan 2005 08:56:01 -0000 @@ -311,8 +311,8 @@ my $TMPDIR = $ENV{'TMPDIR'} || '/tmp'; # If mktemp supports dirs, use it. - $tmp = `(umask 077 && - mktemp -d -q "$TMPDIR/${signature}XXXXXX") 2>/dev/null`; + $tmp = `{ umask 077 && + mktemp -d -q "$TMPDIR/${signature}XXXXXX"; } 2>/dev/null`; chomp $tmp; if (!$tmp || ! -d $tmp) Index: lib/autoconf/fortran.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v retrieving revision 1.183 diff -u -r1.183 fortran.m4 --- lib/autoconf/fortran.m4 28 Mar 2004 20:46:38 -0000 1.183 +++ lib/autoconf/fortran.m4 29 Jan 2005 08:56:02 -0000 @@ -691,7 +691,7 @@ # We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, # then we insist that the "run path" must be an absolute path (i.e. it # must begin with a "/"). -case `(uname -sr) 2>/dev/null` in +case `{ uname -sr; } 2>/dev/null` in "SunOS 5"*) ac_ld_run_path=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'` Index: lib/autoconf/general.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v retrieving revision 1.840 diff -u -r1.840 general.m4 --- lib/autoconf/general.m4 5 Jan 2005 07:53:52 -0000 1.840 +++ lib/autoconf/general.m4 29 Jan 2005 08:56:02 -0000 @@ -388,7 +388,7 @@ # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` +ac_hostname=`{ hostname || uname -n; } 2>/dev/null | sed 1q` exec AS_MESSAGE_FD>&1 Index: lib/autoconf/libs.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/libs.m4,v retrieving revision 1.10 diff -u -r1.10 libs.m4 --- lib/autoconf/libs.m4 5 Sep 2004 03:29:58 -0000 1.10 +++ lib/autoconf/libs.m4 29 Jan 2005 08:56:02 -0000 @@ -188,7 +188,7 @@ acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF - if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + if { xmkmf; } >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. @@ -385,7 +385,7 @@ dnl FIXME: banish uname from this macro! # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . - case `(uname -sr) 2>/dev/null` in + case `{ uname -sr; } 2>/dev/null` in "SunOS 5"*) AC_MSG_CHECKING([whether -R must be followed by a space]) ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" Index: lib/autoconf/status.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v retrieving revision 1.48 diff -u -r1.48 status.m4 --- lib/autoconf/status.m4 21 Dec 2004 14:24:01 -0000 1.48 +++ lib/autoconf/status.m4 29 Jan 2005 08:56:02 -0000 @@ -1317,7 +1317,7 @@ $ $[0] $[@] _CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&AS_MESSAGE_LOG_FD +echo "on `{ hostname || uname -n; } 2>/dev/null | sed 1q`" >&AS_MESSAGE_LOG_FD echo >&AS_MESSAGE_LOG_FD _ACEOF Index: lib/autotest/general.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v retrieving revision 1.170 diff -u -r1.170 general.m4 --- lib/autotest/general.m4 28 Jan 2005 21:21:32 -0000 1.170 +++ lib/autotest/general.m4 29 Jan 2005 08:56:02 -0000 @@ -172,10 +172,10 @@ done fi -# Not all shells have the 'times' builtin; the subshell is needed to make +# Not all shells have the 'times' builtin; the { } grouping is needed to make # sure we discard the 'times: not found' message from the shell. at_times_p=false -(times) >/dev/null 2>&1 && at_times_p=: +{ times; } >/dev/null 2>&1 && at_times_p=: # CLI Arguments to pass to the debugging scripts. at_debug_args= Index: lib/m4sugar/m4sh.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v retrieving revision 1.132 diff -u -r1.132 m4sh.m4 --- lib/m4sugar/m4sh.m4 28 Jan 2005 21:21:32 -0000 1.132 +++ lib/m4sugar/m4sh.m4 29 Jan 2005 08:56:02 -0000 @@ -236,7 +236,7 @@ for as_shell in $as_candidate_shells $SHELL; do AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY], - [($as_shell) 2> /dev/null])], + [{ $as_shell; } 2> /dev/null])], [CONFIG_SHELL=$as_shell as_have_required=yes AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], [$as_shell 2> /dev/null])], @@ -621,7 +621,7 @@ s/.*/./; q']]) m4_defun([AS_DIRNAME], -[(dirname $1) 2>/dev/null || +[{ dirname $1; } 2>/dev/null || AS_DIRNAME_EXPR([$1]) 2>/dev/null || AS_DIRNAME_SED([$1])]) @@ -665,7 +665,7 @@ # -------------------- # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line. m4_defun([_AS_BASENAME_PREPARE], -[if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +[if { basename /; } >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false @@ -974,22 +974,22 @@ cat <<_ASUNAME m4_text_box([Platform.]) -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` +hostname = `{ hostname || uname -n; } 2>/dev/null | sed 1q` +uname -m = `{ uname -m; } 2>/dev/null || echo unknown` +uname -r = `{ uname -r; } 2>/dev/null || echo unknown` +uname -s = `{ uname -s; } 2>/dev/null || echo unknown` +uname -v = `{ uname -v; } 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `{ /usr/bin/uname -p; } 2>/dev/null || echo unknown` +/bin/uname -X = `{ /bin/uname -X; } 2>/dev/null || echo unknown` + +/bin/arch = `{ /bin/arch; } 2>/dev/null || echo unknown` +/usr/bin/arch -k = `{ /usr/bin/arch -k; } 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `{ /usr/convex/getsysinfo; } 2>/dev/null || echo unknown` +hostinfo = `{ hostinfo; } 2>/dev/null || echo unknown` +/bin/machine = `{ /bin/machine; } 2>/dev/null || echo unknown` +/usr/bin/oslevel = `{ /usr/bin/oslevel; } 2>/dev/null || echo unknown` +/bin/universe = `{ /bin/universe; } 2>/dev/null || echo unknown` _ASUNAME Index: tests/local.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/local.at,v retrieving revision 1.9 diff -u -r1.9 local.at --- tests/local.at 1 Jan 2005 08:12:12 -0000 1.9 +++ tests/local.at 29 Jan 2005 08:56:02 -0000 @@ -197,7 +197,7 @@ # In this case just don't pay attention to the env. It would be great # to keep the error message but we can't: that would break AT_CHECK. m4_defun([AC_STATE_SAVE], -[(set) 2>&1 | +[{ set; } 2>&1 | $GREP -E -v -e 'm4_join([|], [^a[cs]_], [^((exec_)?prefix|DEFS|CONFIG_STATUS)=], -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/