On Fri, Apr 09, 2021 at 01:23:09AM +0200, Léa Gris wrote: > > You could have a look: > > https://f-hauri.ch/vrac/mandelbrot_backgndBc.sh.txt > > https://f-hauri.ch/vrac/mandelbrot_backgndBc_4macOs.sh.txt
> Have a look at my POSIX/shell version that is even slightly faster: > https://gist.github.com/leagris/59e1b7e72462024b278652696f375e71 Faster if run under dash or busybox, not using bash! But, why did you exec 8<>"$bcin";exec 9<>"$bcout" then don't use `echo >&8` nor `read <&9`? As you are re-adressing FS at every read/write, your script is still something slower! Test and compare my re-modified version of your (dropped trap exit and addressing FSs, operate few seconds quicker). https://f-hauri.ch/vrac/mandelbrot_posix.sh.txt But there is less to do with [bash]. > There is no need for bash specific features, although coproc and other > fancynesses can help, these lack portability. Of course many bashisms could be avoided to stay POSIX portable. In that way, commands like `coproc` are useless if not counter productive. My meaning here was to improve coproc in order to by able to drive STDERR too. -- Félix Hauri - <fe...@f-hauri.ch> - http://www.f-hauri.ch