delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/31/23:20:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <200401010419.i014Jbqd016872@guild.plethora.net>
From: seebs AT plethora DOT net (Peter Seebach)
Reply-To: seebs AT plethora DOT net (Peter Seebach)
To: cygwin AT cygwin DOT com
Subject: Re: Question about ash and getopts
In-reply-to: Your message of "Wed, 31 Dec 2003 18:57:36 PST." <bt02b2$id8$1@sea.gmane.org>
Date: Wed, 31 Dec 2003 22:19:37 -0600
X-IsSubscribed: yes

In message <bt02b2$id8$1 AT sea DOT gmane DOT org>, Shankar Unni writes:
>I guess the big question now is: how would Peter "prove" to anyone's 
>liking that ash+getopts ~= ash-getopts in performance (and nowhere near 
>"bash")?  Is there some acceptance criterion that anyone's willing to 
>spell out? PTC is fine, but it's hard to evaluate a patch unless an 
>objective (or even subjective) performance criterion is spelled out..

Well, in this case, it turns out to be fairly easy to demonstrate, simply
because the ash in /bin/sh *has* the getopts code, all it's missing is the
entry in the builtin command table.  Because the command table lookup only
checks string equality if first letter matches, the total code executed is
roughly
	if (*a[x].string == *n && (unexecuted)
	goto increment
	++x;
	if (x < MAX_X)
on each command hit.  This is, quite clearly, lost in the noise.  You can
verify this (I did) with
	$ strings /bin/sh.exe | grep getopts
which prints the usage message found only in the actual getopts function.

Note also that, on the gcc configure script, the difference between /bin/sh
and bash is maybe 5 seconds on a script that takes nearly 3 minutes.  It's
hard for me to imagine this being the source of the word "abysmal"; I'm
assuming something else was changed.  Maybe different optimizer flags were
used on /bin/bash back then, which produced worse results?

-s

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019