Do you know where your variables are? | |
PerlMonks |
Re^3: Remove double bracket and singe quotesby Marshall (Canon) |
on May 02, 2016 at 20:23 UTC ( [id://1162042]=note: print w/replies, xml ) | Need Help?? |
Very cool on the benchmarks! As we see, fewer lines in Perl doesn't always mean faster execution speed. Sometimes 3 lines can beat 1 line, as demonstrated by your code. That is important and this is often missed here. I figure Benchmark #2 is slower than BenchMark #1 because more thinking has to go on for each encounter with a bracket. In this case, specifiying an action with double bracket is faster than an action upon each bracket. The fastest is tr, which I expected. This thing is "dumb", but fast.
In Section
Seekers of Perl Wisdom
|
|