in reply to Re: Label makes a sub to return empty list -- "secret"? documented?
in thread Label makes a sub to return empty list -- "secret"? documented?
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Label makes a sub to return empty list -- "secret"? documented?
by ikegami (Patriarch) on Sep 13, 2025 at 04:09 UTC | |
by hippo (Archbishop) on Sep 13, 2025 at 09:26 UTC | |
by ikegami (Patriarch) on Sep 13, 2025 at 14:48 UTC | |
Re^3: Label makes a sub to return empty list -- "secret"? documented?
by LanX (Saint) on Sep 13, 2025 at 23:23 UTC | |
by Anonymous Monk on Sep 14, 2025 at 18:44 UTC | |
by LanX (Saint) on Sep 14, 2025 at 20:48 UTC |