Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: L A Walsh Newsgroups: gnu.bash.bug Subject: Re: expression evaluation problem Date: Fri, 26 Jul 2019 03:04:12 -0700 Lines: 42 Approved: bug-bash@gnu.org Message-ID: References: <5D3889D2.3090101@tlinx.org> <20190724175103.GN1218@eeg.ccf.org> <5D38A6BF.9020309@tlinx.org> <66182cdf-4448-8b49-fa65-d28ef1c64b95@iki.fi> <5D3AD01C.6010203@tlinx.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1564135482 15395 209.51.188.17 (26 Jul 2019 10:04:42 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash To: Ilkka Virta Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird In-Reply-To: <66182cdf-4448-8b49-fa65-d28ef1c64b95@iki.fi> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <5D3AD01C.6010203@tlinx.org> X-Mailman-Original-References: <5D3889D2.3090101@tlinx.org> <20190724175103.GN1218@eeg.ccf.org> <5D38A6BF.9020309@tlinx.org> <66182cdf-4448-8b49-fa65-d28ef1c64b95@iki.fi> Xref: csiph.com gnu.bash.bug:15248 On 2019/07/25 11:15, Ilkka Virta wrote: > On 24.7. 21:43, L A Walsh wrote: > >> The important part for me is whether or not it is faster to perform >> 1 calculation, or 100. So which would be faster? In this case >> execution speed >> is more important than clarity. I consider that a 'constraint'. >> > > Shouldn't it be easy enough to measure how much restructuring that > expression affects the execution speed? > --- Which I did and found a 25% difference using the test case I used. It would likely be less in shorter strings, more in longer ones. > Also, regarding execution speed, I've been led to believe that the shell > in general is rather slow, and almost any other language would be better > if that is of concern. (awk, Perl, what have you.) > ---- True, assembly would probably be the best choice if that was a sole concern, but sometimes I want to have an example of how to do something using only 1 language. Similarly, many perl modules have versions that require a compiler to install, but some that are perl-only can work with perls going back to 5.6 or up to 5.30 with no recompilation step. So sometimes there's a desire for an efficient implementation, while staying within the same language. Similarly, by not using some newer bash features, one can have scripts that are portable to a wider range of bash versions. > >