Hello Wouter, Wouter Verhelst <[EMAIL PROTECTED]> wrote: > On Fri, May 19, 2006 at 04:49:49PM +0200, Olaf van der Spek wrote: >> On 5/19/06, Wouter Verhelst <[EMAIL PROTECTED]> wrote: >> Why would they have to work with dash? > > If the difference in speed is indeed that insane, that's nice. > > I've received a bugreport with patch against the nbd packages now which > implement whatever it's doing now with eval rather than bash arrays. Now > I'm not sure whether this is actually going to be any faster (eval might > require more processing time than arrays?),
Do you search something like this: % /usr/bin/time dash -c 'i=0; while [ $i -lt 10000 ]; do \ eval test -n "\$foo_$i"; i=$(($i+1)); done' 0.50user 0.00system 0:00.52elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+202minor)pagefaults 0swaps % /usr/bin/time bash -c 'i=0; while [ $i -lt 10000 ]; do \ test -n ${foo[$i]}; i=$(($i+1)); done' 1.54user 0.04system 0:01.59elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+518minor)pagefaults 0swaps But I would not weight this comparison to high. This tests only a _part_ of the init script. But what counts more in the comparison dash vs. bash is the shell startup. And the shell is started for every script not name foo.sh. % /usr/bin/time dash -c 'i=0; while [ $i -lt 100 ]; do \ /bin/bash -c true; i=$(($i+1)); done' 1.13user 0.53system 0:01.68elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+43209minor)pagefaults 0swaps % /usr/bin/time dash -c 'i=0; while [ $i -lt 100 ]; do \ /bin/dash -c true; i=$(($i+1)); done' 0.13user 0.19system 0:00.32elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+19309minor)pagefaults 0swaps Some more shells: % /usr/bin/time dash -c 'i=0; while [ $i -lt 100 ]; do \ /bin/zsh -c true; i=$(($i+1)); done' 1.56user 0.65system 0:02.23elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+50709minor)pagefaults 0swaps % /usr/bin/time dash -c 'i=0; while [ $i -lt 100 ]; do \ /bin/posh -c true; i=$(($i+1)); done' 0.14user 0.25system 0:00.75elapsed 53%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (1major+20208minor)pagefaults 0swaps Bye, Jörg. -- Der kommt den Göttern am nächsten, der auch dann schweigen kann, wenn er im Recht ist. (Cato; 234-149 v. Chr.) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]