Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by sundialsvc4 (Monsignor)
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-09-03 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls