Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: When should I use a dispatch table?

by runrig (Abbot)
on Dec 01, 2006 at 07:21 UTC ( [id://587138]=note: print w/replies, xml ) Need Help??


in reply to Re^3: When should I use a dispatch table?
in thread When should I use a dispatch table?

Yes, my version requires that there is a default (I hadn't examined the full version of your code closely as to whether or not it required a default), and although I know exists is more efficient than fetching the value unconditionally, overall efficiency depends on what the common case is. If most of the time you are fetching an existing value, then you may as well fetch it instead of testing for existence and then fetching it anyway. Your version always tests for existence then fetches one value or the other.

Also, I agree w/chromatic's rant below, and the usual rant about premature optimization also applies (though I realize benchmarking this sort of thing can sometimes be a fun way to pass the time). :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-03-28 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found