go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'd hoped that. I'd heard enough people claiming otherwise that I guessed that perhaps Perl wasn't that smart. I also noticed that none of the benchmarking code in this thread was making a straight substitution of /.../o with $qr between the cases. So I picked the code that had the most similar test cases and added one, got results even better than I expected, quadruple checked things because "better than expected benchmarks" almost always means "mistake made". Adding another case for /$qr/, I get it being nearly identical to my $_ =~ $qr case (which is faster than /.../o, perhaps just because the qr/.../ part is done outside the scope of the benchmarking; but "fixing" that would be more work than I care to invest at this point). So I suspect that diotalevi is correct in both that =~ /$qr/ and =~ $qr produce identical code and that the benchmark results showing qr// to be slower than //o have to do with other code differences between the cases and/or the order that operations get run (or chance). Thanks, diotalevi. - tyeIn reply to Re^4: Never (qr//)
by tye
|
|