bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why are long functions slower?


From: Bernhard M. Wiedemann
Subject: Re: Why are long functions slower?
Date: Mon, 16 Oct 2017 11:29:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 2017-10-15 20:53, Eduardo A. Bustamante López wrote:
> I have some questions:
> 
> 1. Which specific versions of 4.3 and 4.4?
> 2. Did you compile bash from source? (if so, what did you use for CFLAGS and 
> the configure script parameters? are you
>    using bash's malloc or the system malloc?)
> 3. ... Or did you use a distro package? (if so, can you provide links to the 
> specific packages used?)


I was testing with the openSUSE Tumbleweed packages, which is probably
compiled with -O2 and pretty standard configure options:
https://build.opensuse.org/package/view_file/openSUSE:Factory/bash/bash.spec
around line 429

> 4. Do you have precise timing information? How specifically did you test? How 
> many iterations? etc

I used the reproducer script in my previous email, containing two
similar functions (one short, one long) that both do nothing in a loop
with N=30000
and was comparing the timing of those two on the same bash version.

e.g. for bash-4.3 on a 2.80GHz Core i7 I get

real    0m0.271s
user    0m0.270s
sys     0m0.003s

real    0m0.482s
user    0m0.483s
sys     0m0.000s


interestingly, the number of colons has a much larger impact on runtime
than the number of spaces.

Thanks for looking into that.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]