I could be wrong, but as I recall, when your program enters a scope, 
perl immediatly identifies the the scratchpad to use.  Then, it need 
only search backwards up the tree of scratchpads to find the variable 
"$x", which is faster than iterating through the STHASH looking for a 
localized or global $x.

I think Mark-Jason Dominus has much more indepth look at the perl 
internals on his website... plover.com

Robert Landrum

>Anybody know offhand *why* my() lexicals are supposedly faster?
>If they're stored on a scratchpad for the scope, which is an array,
>(technically a stack of them to accommodate recursion,) then exactly
>how does Perl go about finding which data location you mean when you
>say $x for a lexical?  $::x has to go through the package lookup, which
>(if I recall correctly) is technically a hash element of a hash element
>at least......but if the scratchpad has a lot of scope-specific
>lexicals, how does it find which one is x?
>
>my $brain = 'tapioca'; #=o)
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Auctions - Buy the things you want at great prices.
>http://auctions.yahoo.com/


--
Warning: The contents of this message are made of bits which may or may not
be an accurate representation of my thoughts.

Reply via email to