Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Faster with my keyword or no ?

by BillKSmith (Monsignor)
on Nov 24, 2021 at 04:18 UTC ( [id://11139068]=note: print w/replies, xml ) Need Help??


in reply to Faster with my keyword or no ?

We strongly recommend that you always use strict in every script. Under strict, you must declare all your variables (my for lexical, our for global). Without strict, all variables default to 'package'. Your question becomes "Which type of variable is faster?" I doubt that it makes much difference.

In general, It is better to have a program that is easy to maintain than it is to have one that is marginally faster. ('strict' and 'my' offer several advantages to the maintainer.) The usual recommendation is to not even consider execution speed until you have a complete program that works correctly, but is unacceptably slow. At that point, profile it to identify the problem area. Write several versions of this code. Benchmark each with realistic data. (You will almost always be surprised by the result). Resist the temptation to make "easy changes" to speed-up other sections. Even a big improvement will make little difference in your complete program.

Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found