Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
No such thing as a small change
 
PerlMonks  

Re: Better way of accessing fields

by matija (Priest)
on Mar 18, 2004 at 14:28 UTC ( [id://337774]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Better way of accessing fields

First of all: you say you know arrayref is faster than hashref - but is the combination of taking an arrayref and then stuffing it into an array by hand really faster than hashref? You have to consider the possibility that the time you saved by using the arrayref is subsequently wasted by that long raft of assignment statements.

Second, how often is this loop going to execute? If this loop happens 10 times per execution of your program, you probably wasted more time typing all those assignments than you saved by using arrayref. If the loop executes 10_000_000 then it is probably worth your while to benchmark both solutions, and judge for yourself which is really faster.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://337774]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.