Configuration Information: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 uname output: Linux medium 5.10.0-12-amd64 #1 SMP Debian 5.10.103-1 (2022-03-07) x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.2 Patch Level: 0 Release Status: rc2 Description: Trying some script under 5.2 beta, rc1 and rc2, I was surprised by execution time. In order to compare, I've tried to establish execution time of elementar operations, like: - {0..999} .`: {0..999}` - 3x{0..9} `: {0..9}{0..9}{0..9}` - readUt `read -r ut idl </proc/uptime` - RE `[[ $cnt =~ ^[0-9]*\..*$ ]]` - InLneStr `: <<<"Hello world!"` - IncInt `int+=1` - AccessRt `: "$EPOCHREALTIME"` - PrintF `printf -v int '%s+%s' $int 1` Here is results of my comparission between different version of bash: (1st column show number of empty loop in 0.2 seconds as reference) $ for((i=0;i<${#bashs[@]};i++)){ ${bashs[i]} timedTest.sh ${args[i]:--q};} l/.2s {0..999} 3x{0..9} readUt RE InLneStr IncInt AccessRt PrintF Version BuildDir 66222 330.31 338.28 13.17 19.02 63.16 0.08 2.69 1.18 5.0.17(1)-release /tmp/bash/bash-5.0/bash 73720 366.97 379.70 13.20 17.80 10.09 0.10 2.46 1.19 5.1.4(1)-release /bin/bash 60585 409.92 419.53 13.62 19.87 10.87 0.09 3.00 1.38 5.1.4(1)-release /tmp/bash/bash-5.1.4/bash 62416 417.85 423.23 14.63 20.84 11.34 0.36 3.05 1.43 5.1.4(1)-release /tmp/bash/bash-5.1.4/bash_dynlib 62538 416.97 439.28 13.65 20.69 12.51 0.29 3.05 1.57 5.1.4(1)-release /tmp/bash/debian/bash-5.1/bash 60664 419.54 425.89 14.25 21.05 11.01 0.57 3.12 1.38 5.1.16(1)-release /tmp/bash/bash-5.1.16/bash 40808 39995.10 39995.10 18.49 35.46 15.65 0.34 5.81 2.40 5.2.0(1)-beta /tmp/bash/bash-5.2-beta/bash 40134 33328.35 39995.02 18.88 31.18 14.73 0.29 6.19 2.20 5.2.0(1)-rc1 /tmp/bash/bash-5.2-rc1/bash 40350 39995.04 39995.04 19.10 32.20 14.66 0.59 6.15 2.26 5.2.0(1)-rc2 /tmp/bash/bash-5.2-rc2/bash Where if everything seem slower, accessing $EPOCHREALTIME like `prinf -v INTEGER '%s+%s' $INTEGER 1` or using Regular Expression use approx 2x more time, but a sequence of 1000 using brace expansion require 100x more time!! Another test (first script I wrote) is something slower, but render approx same results: $ for((i=0;i<${#bashs[@]};i++)){ ${bashs[i]} looptest.sh ${args[i]:--q};} l/.02s {0..999} 3x{0..9} readUt RE InLneStr IncInt AccessRt PrintF Version BuildDir 1468 340.47 348.36 16.71 22.54 51.44 1.71 5.10 3.51 5.0.17(1)-release bash-5.0/bash 1714 366.64 380.21 15.11 20.11 12.23 1.33 3.99 2.35 5.1.4(1)-release /bin/bash 1074 414.53 423.91 15.91 22.94 12.78 1.72 4.77 2.54 5.1.4(1)-release bash-5.1.4/bash 1444 413.59 418.95 16.80 22.83 13.21 1.70 4.71 2.51 5.1.4(1)-release bash-5.1.4/bash_dynlib 1360 421.20 432.83 16.33 22.79 12.98 1.82 4.87 2.59 5.1.4(1)-release debian/bash-5.1/bash 1134 420.00 428.62 16.76 22.74 13.12 1.78 4.92 2.60 5.1.16(1)-release bash-5.1.16/bash 687 40158.21 40676.12 23.73 38.81 18.98 3.96 9.87 3.94 5.2.0(1)-beta bash-5.2-beta/bash 607 39559.71 40192.35 23.38 37.68 19.08 3.95 9.98 3.99 5.2.0(1)-rc1 bash-5.2-rc1/bash 740 40531.76 40965.16 24.38 37.99 19.13 3.94 10.05 3.95 5.2.0(1)-rc2 bash-5.2-rc2/bash Repeat-By: https://f-hauri.ch/vrac/timedTest.sh.txt https://f-hauri.ch/vrac/looptest.sh.txt -- Félix Hauri - <fe...@f-hauri.ch> - http://www.f-hauri.ch