in reply to Re^2: Remove double bracket and singe quotes
in thread Remove double bracket and singe quotes
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.
|
---|