in reply to Re^2: map vs for (not the usual breed)
in thread map vs for (not the usual breed)
The magic goto really introduces a bit more (or another) overhead, in that it looks back and forth, saves @_, carefully disassembles the current stack frame and replaces it with the one of the called sub, and then restores @_. The magic goto is most useful to replace the current subroutine, mainly to eliminate AUTOLOAD from what caller() might report. So in replacing &z with goto &z we are trading localizing @_ against disassembly of a whole sub frame. I don't know what's "cheaper".
&z is really a shorthand of z(@_) which additionally overrides the argument prototypes of sub z (if any).
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: map vs for (not the usual breed)
by blazar (Canon) on Jun 27, 2007 at 15:25 UTC |