On Mon, Feb 24, 2003 at 02:06:38AM +0000, hv@crypt.org wrote: > Precompiling the returned patterns bypasses the (obviously buggy) > optimisation altogether. I think it might make most sense to remove > the optimisation and document this as the recommended approach. The optimization seems to be valuable even in simple, un-branched cases, so why not keep it in ? $ dd if=/dev/zero count=4096 | time perl -ne '$a=1; m/(??{ $a })/' 3.96user 0.00system 0:03.98elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k ( optimized ) 55.04user 0.01system 0:55.08elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k ( unoptimized ) Notice that my patch ( the second variant ) doesn't affect the rest of the code in way: the only drawback is the bloat of this little magic_setregexp() function. Of course, it's always better to precompile its regexp's and to avoid (??{ .. }) altogether. But why forcing a speed regression, even for weird cases ? Regards AdiThread Previous | Thread Next