Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14977
| Path | csiph.com!goblin3!goblin.stu.neva.ru!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | "G. Branden Robinson" <g.branden.robinson@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Should [[ -v 1 ]] be supported? |
| Date | Thu, 27 Dec 2018 20:36:25 -0500 |
| Lines | 57 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.6428.1545961029.1284.bug-bash@gnu.org> (permalink) |
| References | <CABrM6wmrn2gi8_HgmRg67B5nsgGNFRn8Bn-r20MvC-_2LJHZ0g@mail.gmail.com> <5dac2cf2-2fac-0fd1-058f-6a84a3271738@case.edu> <abd86dbc-f6e2-62bd-e9dc-f959e2dbff9f@inlv.org> <CABrM6wkGwVbPdrXTetVsFCiwDPg5JnK4KRh49WqACsKhrrMMdA@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ucsrfnzwexh2wzx2" |
| X-Trace | usenet.stanford.edu 1545961030 12691 208.118.235.17 (28 Dec 2018 01:37:10 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i5QdNQDhMZS/S7NQ7mOAVchI5fg3pjA0HAaHANo18yY=; b=IfVt++4LRPBJYh69Ck165h8v6gjyU7zow3ejw9ZxoMsM8vGXoMcwBIK2LkOTLK36fJ viTZ3xs3cWW6bMiJNs8cocmsRCmpf2Sli21ji9nnJNVY8lbJ4jjjnopXYkGHvZHX7pIq kr+tt93tFd/XUvs1X4OOoq2X0rX249SiQmKr1ffL9pONn8bWtFTnsagthAVKMW4AkADK hIDTnEsS6K7c3jro3PF7HZVd18KHacUiWl9TXnhM3ZdjNxtLinr2eD2FRc5jMu3LJCPI DBPKII4rDPajntdafOXF3e4wAsTKQujq3ZMDyWz6c6NtR0Il84pXQMonGe02l0TtsY1G LWOw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=i5QdNQDhMZS/S7NQ7mOAVchI5fg3pjA0HAaHANo18yY=; b=Q890GEfX10UYd9TxVg7pK4/FNYrvpzKIui+WuRneOfXddSwj6ALyogZD4ZolgpZMly K9TWHKzxovS8IBjIf+UJ8HG0IDa9zYJPsnVl5YP1RN2miSjTsWOMusib9/OmhYxrAcK2 ImLHll7empEAx+msXtoLTKmBhxJxW3++DvmF2PUMpvvS3t+0ziFXP3qrJMUJ7VpXAizu NIy5wo9CdQ9XMHtfGUeEllACsNBmUeo5StpD2sLXDd9Ay2wFHvWEFvjfmfBcX8cJMZSx R2L1rWYSZC3QHLELXFhweozjgRYDOaZqBfKBhNlf2FKrRIlAgaWvZ5Jy5/crjTEuAsdG IY0g== |
| X-Gm-Message-State | AJcUukf5pWxUPFEPhIbP9YitF05BTs19nwpG9nGqGgADklekASr86FmZ Xzir7P8LkazPdk/wA1VgjHSFsxtGY2w= |
| X-Google-Smtp-Source | ALg8bN5Cwooe2NBcojyVShEqLUMQy/s0zipWhEg0nU9ZmZsDWCVlSyRM9bVI3Ec06OIWQZ9rbUMS5w== |
| X-Received | by 2002:a25:9b04:: with SMTP id y4mr17574906ybn.182.1545960988226; Thu, 27 Dec 2018 17:36:28 -0800 (PST) |
| Content-Disposition | inline |
| In-Reply-To | <CABrM6wkGwVbPdrXTetVsFCiwDPg5JnK4KRh49WqACsKhrrMMdA@mail.gmail.com> |
| User-Agent | NeoMutt/20180716 |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:4864:20::b31 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14977 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
At 2018-12-27T18:39:26-0600, Peng Yu wrote: > What I meant in my original email is that I want something for testing > if there is a command line argument (one or more, the exact number > does not matter). $# gives more than that info, because it tells not > only whether is any command line argument, but also how many. This > could lead to slower performance if the goal is to just test if there > is an argument. You should look into how integer comparisons are done in hardware. For instance, comparison and subtraction operations are often comparable (or even identical) in cycle count because they both perform a subtraction "under the hood". You need to be programming in assembly language to influence execution at such depths. See, e.g., https://www.quora.com/What-is-the-difference-between-cmp-and-sub-instruction-in-8086microprocessor As others have noted, if you are worried about marginal performance impacts this small, margin you are probably writing in the wrong language, or distracting yourself with tiny details when you do not even know the cyclomatic complexity of your code or the big-O classification of your algorithms. Attack those problems first, and see what you discover. Regards, Branden
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Should [[ -v 1 ]] be supported? "G. Branden Robinson" <g.branden.robinson@gmail.com> - 2018-12-27 20:36 -0500
csiph-web