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


Groups > gnu.bash.bug > #14983 > unrolled thread

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

Started byEduardo Bustamante <dualbus@gmail.com>
First post2018-12-27 17:53 -0800
Last post2018-12-27 17:53 -0800
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#14983 — Re: Should [[ -v 1 ]] be supported?

FromEduardo Bustamante <dualbus@gmail.com>
Date2018-12-27 17:53 -0800
SubjectRe: Should [[ -v 1 ]] be supported?
Message-ID<mailman.6434.1545962567.1284.bug-bash@gnu.org>
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.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web