Thanks, everyone. FWIW (I usually distrust multi-millions-per-sec benchmarks):
cmpthese 5e7, { 1 => sub { my $x = 1 + 1; return }, 2 => sub { my $x = 1 + 1; () }, 3 => sub { my $x = 1 + 1; _: }, }; 1 27367269/s -- -13% -22% 2 31367629/s 15% -- -11% 3 35161744/s 28% 12% --
"Perl subs are expensive"? The cheapest adjustment is just above. Otoh, now I have a justification (not that I need any or anyone cares) not to follow PBP's "Place the label on the line preceding the loop keyword" -- just in case, easier and safer while debugging and commenting-out this or that, to keep label and code on the same line.
In reply to Re^2: Label makes a sub to return empty list -- "secret"? documented?
by Anonymous Monk
in thread Label makes a sub to return empty list -- "secret"? documented?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |