Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Coding style

by ruzam (Curate)
on Jul 13, 2010 at 14:14 UTC ( [id://849275]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Coding style
in thread Coding style

When I need to speed up code I go looking for nested hash references as in your example. It's my believe the cost of creating a new variable is small(er) compared to the cost of looking up the value of a nested reference. If the same value is referenced more than once, it's worth creating a variable to skip as much dereferencing as you can.

The fact that it's more readable is just a bonus.

Replies are listed 'Best First'.
Re^4: Coding style
by nyamned (Sexton) on Jul 13, 2010 at 16:56 UTC
    Wow, I was surprised to discover this. It is really faster with temporary variable.
    Thanks everyone for sharing your thoughts.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-19 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found