Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: declaring lexical variables in shortest scope: performance?

by GrandFather (Sage)
on Mar 31, 2020 at 20:51 UTC ( #11114867=note: print w/replies, xml ) Need Help??


in reply to declaring lexical variables in shortest scope: performance?

In C/C++ the equivalent outer/inner code would perform identically. The compiler allocates space for all the local variables that might be needed on the stack on entry to the sub, usually by effectively incrementing the stack pointer. The "overhead" to create space for the local variables is typically the execution time of one processor instruction on each entry to the sub.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
  • Comment on Re: declaring lexical variables in shortest scope: performance?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11114867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2020-10-01 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (13 votes). Check out past polls.

    Notices?