Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: How to pass two lists to a sub?

by revdiablo (Prior)
on Nov 05, 2004 at 19:25 UTC ( [id://405597]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to pass two lists to a sub?
in thread How to pass two lists to a sub?

Some benchmarking I carried a few months ago indicated that evaluating $array[$i] was faster than evaluating $arrayref->[$i].

I am not trying to say your benchmark is wrong, and I don't want to say there are no applications where this would make a difference, but using this as a general rule of thumb does not strike me as a good idea. I would be very surprised if most, or even many, applications would benefit from this kind of nano-optimization.

More generally, this type of benchmarking is almost always pointless. Using it in isolation to determine the semantics of your code is, frankly, silly. There may be cases where these types of small optimizations add up to real savings, but those are the exception, not the rule. Contorting your code for the exception, without knowing if you are truly hitting that exception, is a waste of time and effort.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-06-19 19:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.