Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Eduardo Bustamante 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: References: <5dac2cf2-2fac-0fd1-058f-6a84a3271738@case.edu> 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 , bug-bash To: Peng Yu 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14983 On Thu, Dec 27, 2018 at 5:38 PM Peng Yu 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.