Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14983

Re: Should [[ -v 1 ]] be supported?

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Eduardo Bustamante <dualbus@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Should [[ -v 1 ]] be supported?
Date Thu, 27 Dec 2018 17:53:44 -0800
Lines 41
Approved bug-bash@gnu.org
Message-ID <mailman.6434.1545962567.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> <e190ca7a-57a7-5cf5-8001-48806fa98caf@inlv.org> <CABrM6wmgN7+03dvLySy0D=R1PnKwN6-9pM-8mD7VNy8P6u1NLw@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1545962568 13655 208.118.235.17 (28 Dec 2018 02:02:48 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Martijn Dekker <martijn@inlv.org>, bug-bash <bug-bash@gnu.org>
To Peng Yu <pengyu.ut@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a1HMvvXgHNcFx6346PKlAqKfEJRHcDSDfTBTgmAJdvI=; b=KUcpht256n/HlLyG4zLcASUWjkP7u0ekfS5QNCRSkYm4Slg2d3+59cQTLlEEN4ZUnP x0TE2eRmuNPXjQfE4I1ptfWZgVFgdiXTFiX10QaE4liZgN3G7SiyZhSBqBs8XGBf/uea mqeLe5Ub945UKy2EYUr2J9X65ErR/9yaDsqSdBjs24lOP1J2RLDru/mMtXjEaK1CaSt+ USlQdK0BxNlUNGhqRLdvoa9LOpGHtMFtHr0Fg6I5QvdWadhqEPKOM+gN+YZmDY7F7DLI hXabmb4FzWUKD3dDG0DtqWcSPegqgRwZm1Aui5sar0pH/iiMNnraxKdzlNS1qPJbn7hs AVWA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a1HMvvXgHNcFx6346PKlAqKfEJRHcDSDfTBTgmAJdvI=; b=SQuYzekICHPPa05tNnuyXhUMW4cNu361yagM6dVoGth1tjmelAAZEOKkWScGpFGMP9 nT97nbLtdAXhNVwtoC/iX0wJZ2V2weCs6ChrV8yL9x+H7sLZEIpZF+9yvAlirvkXBlJZ waNRI2vaAI9BD8I2a2raJk/WeHfL2Z62+5xIlhuKzQTB8D1jHOlq+CH5yRdGK9eiLyn0 gzDUUCdMoRlUpN7hzgUqjG0oWAtN9y9gWko9rm/97oOZRQpczYH+l9fjtTDLoKYuBiHi DF9th3GVjD2MKGPakfEDn03WltjWYDhYobl9IS8uqngKEiB0dzd9cSIyfWp1UqP4j6OH izug==
X-Gm-Message-State AA+aEWYrlrx+Yact9+8L1VepdOF5lsT/4e5v1Z1k2THbPppaYc4Pk+FW w4u8rbtlpntQGEHJKBYWksfhYlwuLwW8fOEnvUI=
X-Google-Smtp-Source AFSGD/VcmuGLR8IgZWUZDN42CIqx1vwdy0CMpXLB26RKi353sQxyYjpM/5PBmSCYtGkwXZCLKGFT/NKh6I+FXK+onac=
X-Received by 2002:a19:6a13:: with SMTP id u19mr12415388lfu.46.1545962038413; Thu, 27 Dec 2018 17:53:58 -0800 (PST)
In-Reply-To <CABrM6wmgN7+03dvLySy0D=R1PnKwN6-9pM-8mD7VNy8P6u1NLw@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4864:20::12a
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:14983

Show key headers only | View raw


On Thu, Dec 27, 2018 at 5:38 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> > I don't believe that at all. The number of positional parameters is kept
> > anyway. It's not recalculated when you compare it to another number, so
> > it's just as fast as a simple comparison of two integers.
>
> Getting the number $# is slow.

How do you determine that? All I ever see in your emails is that you
run things in a loop, get the wall clock and then absolutely declare
that something is slow/fast. That doesn't seem very methodical /
scientific.

* What hardware are you using to test?
* What is the state of the system during your tests?
* Are you also measure variability between runs?
* Are you testing in different hardware architectures?
* Are you testing with different compilers and compiler flags?

Let's say you are doing all of the above. You found that this
particular operation is "slow".

How many times do you execute the operation? Is your program really
spending MOST of its time computing the number of positional
parameters, really? REALLY?

If so, what are you doing? Is it a common enough thing that most of
bash users are going to benefit from this change? No? Just you?


> There is no reason why bash has to be slow. Javascript was slow. But
> it has been optimized to be much faster than it was before.

You do realize that bash is a SPECIALIZED language, not a general
purpose language? This is a poor argument.

In general, I agree that we should look into areas to optimize. You
can see that Chet has been implementing some optimizations over the
years. But the effort should be invested in an area that benefits most
users, not just you trying to do high performance computing in bash.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Should [[ -v 1 ]] be supported? Eduardo Bustamante <dualbus@gmail.com> - 2018-12-27 17:53 -0800

csiph-web