Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: code execution speed and variable name length

by TomDLux (Vicar)
on Aug 04, 2004 at 02:53 UTC ( #379882=note: print w/replies, xml ) Need Help??


in reply to code execution speed and variable name length

When you invoke a Perl function or operator, you have a function call overhead. I would expect processing time for a 20 character key vs a 2 character key to be small relative to function call overhead.

Meaningful names are good, but don't fall into the Java trap of thinking that a $Variable_with_a_very_long_name is neccesarily more communicative than "$colour".

If you are using multi-layered structures with long-ish names, it can clarify your code if you use aliases, especially if you are doing several operations in one vicinity of the structure:

my $board = $game{'placedtiles'}{$currentuser} $board->{$row}{$col} = ... $board->{$row+1}{$col} =... $board->{$row-1}{$col} = ... $board->{$row}{$col+1} = ... $board->{$row}{$col-1} = ...

--
TTTATCGGTCGTTATATAGATGTTTGCA

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2022-12-02 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?