Jan Engelhardt <jengelh@inai.de> wrote:
Btw the comparison is a bit unfair: "configure", by design, is written in the most portable shell dialect possible, forfeiting all chances for bash to catch up with optimized builtins.
So, have bash invest a bit in optimizing the base dialect. It seems ridiculous that a mere syntactical difference leads to such great discrepancies:
» for ((i=0; i<1000000;++i)); do echo '[ "$a$b" = 5 ]'; done >ca1 » for ((i=0; i<1000000;++i)); do echo '[[ "$a$b" = 5 ]]'; done >ca2 » time pbosh ca1 real 0m3.198s user 0m3.145s sys 0m0.052s » time bash ca1 real 0m3.987s user 0m3.985s sys 0m0.000s » time bash ca2 real 0m2.669s user 0m2.668s sys 0m0.000s
If anything else, this reeks of embrace-extend-extinguish. First make [ suck, add [[, then make everyone write [[ just to be able to reach or beat the [ implementation of another sh. Something is wrong here.
Interesting catch! BTW: ksh93 has less differences between [ and [[. Also note that this is a ksh88 feature that has been introduced in order to avoid problems when the position of an operator may be a shell macro and this has been introduced before POSIX rearranged the test(1) definition to mainly depend on the number of parameters. PPS: the next version of bosh will be approx. 15% faster with this command and should be approx. as fast as bash with [[ now. I just make a minor change to the memory management module. Jörg -- EMail:joerg@schily.net (home) Jörg Schilling D-13353 Berlin joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/' -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org