I was trying to determine the best performance for string fill like in:str+=A #one per loopI came with this script for bash:#!/bin/bashbReport=falsenLimit=${1-3000}; #up to 25000echo nLimit='$nLimit'shopt -s expand_aliasesnStop=100000;fMaxWorkTime=1.0;alias GetTime='date +%s.%N';nTimeBegin=`GetTime`;nDelayPart=`GetTime`;strFinal=;str=;fPartWorkSleep=`bc <<< scale=10;($fMaxWorkTime/$nStop)*$nLimit`echo fPartWorkSleep='$fPartWorkSleep'nCount=0;while true;do     str+=A;    ((nCount++))&&:;    if(((nCount%nLimit)==0)) || ((nCount==nStop));then         strFinal+=$str;        str=;        if $bReport;then            echo `bc <<< $(GetTime)-$nDelayPart` #${#strFinal} #`bc <<< $(GetTime)-$nTimeBegin`;            nDelayPart=`GetTime`;        fi        sleep $fPartWorkSleep # like doing some weigthy thing based on the amount of data processed    fi;    if((nCount==nStop));then         break;    fi;done;echo strFinal size ${#strFinal}echo took `bc <<< $(GetTime)-$nTimeBegin`And in bash the best performance/size is when str is limited from 3000 to 25000 characters (on my machine). After each part is filled, it must be emptied and some weigthy action can be performed with str value (and the weight is relative to its size).So my question is, what shell has the best string fill performance? based on what I exposed. I am willing to use other shell than bash, just for this kind of algorithm, it if proves to be faster.PS.: I had to use nCount as checks on string size degraded performance.
string fill performance in shell scripts: what is the best amount and for what shell?
shell;performance;string