Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Small Hash a Gateway to Large Hash?

by dsheroh (Parson)
on Feb 18, 2014 at 09:36 UTC ( #1075302=note: print w/ replies, xml ) Need Help??


in reply to Small Hash a Gateway to Large Hash?

(no, haven't done any profiling)
Well, there's your problem right there.

If a fronting hash would make a difference, you're talking about something that's pretty far into the realm of micro-optimizations. And you should never bother with micro-optimizations unless you've profiled first to see that there's a benefit to be gained by micro-optimizing.

In this particular case, my intuition is that the cost of doing the preliminary hash lookup will be slower than walking the linked list in the bucket where a collision happened anyhow, so, if your idea had any noticeable effect, I suspect it would probably be to make things slower (and more memory-intensive) rather than faster.

But, again, profile before spending any more time contemplating it. 100,000 hash lookups probably take less time than you'll spend reading this sentence, even if they are lookups into a 3GB hash. Even if you could magically optimize that down to zero time, it won't noticeably impact the overall program's performance.


Comment on Re: Small Hash a Gateway to Large Hash?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2014-09-24 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (244 votes), past polls