Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Performance improvement by using $_ instead of named variables

by sundialsvc4 (Abbot)
on Nov 03, 2013 at 13:52 UTC ( #1061046=note: print w/replies, xml ) Need Help??


in reply to Performance improvement by using $_ instead of named variables

To quote from a little book with a lot of punch, The Elements of Programming Style, by Kernighan & Plauger:

Don’t “diddle” your code to make it faster.   Find a better algorithm.

If a program “that does a large amount of text manipulation” is taking a long time to complete, it is most-likely using too much memory.   (For example, are you “slurping” all of the file content into an array?)   It could be using an algorithm that is inefficient in some other way ... and, yes, that could include “copying” values unnecessarily.   Profiling should be the first step of showing you where the “hot spots” are.   Playing monkey-games with variable names, ultimately, will do nothing to speed-up your cod, but a great deal more to introduce bugs into it.

  • Comment on Re: Performance improvement by using $_ instead of named variables

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061046]
help
Chatterbox?
[LanX]: But reu germans have no humor, better to refrain from this site till the troll is gone...
[LanX]: true
[shmem]: I disagree
[LanX]: sure you are German
[shmem]: germans do have humour. Open debate is what germans, and what humour. There. :-)
[LanX]: :-P

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-04-27 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (513 votes). Check out past polls.