in reply to Re^2: 4x faster now!
in thread Syntax Perl Version support $c = () = $a =~ /\./g

"... roughly 'only' 2.5x faster ..."

Interestingly, if you look at the benchmark timings in the perlperf page:

$ perl -E 'say 2040816.33/840336.13' 2.42857144557143

But don't read too much into that: I consider it more of a curiosity than anything else.

"... anything that results in that big of a difference is worth understanding better ..."

Someone else may have a much better answer regarding the inner workings of these. My understanding is that the SEARCH part of y///, e.g. the 'w' in

$ perl -E 'say "xwz" =~ y/w/y/r' xyz

is handled at compile time; whereas the equivalent part of s///, e.g. the 'w' in

$ perl -E 'say "xwz" =~ s/w/y/r' xyz

is handled at runtime. I couldn't tell you exactly what "handled" equates to; maybe another monk can chime in with a more complete answer.

— Ken