Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Small Hash a Gateway to Large Hash?

by dsheroh (Prior)
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1075302]
[marto]: can I nominate users ? :P
[Discipulus]: AM will rulez!
[Corion]: :)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2018-05-22 08:33 GMT
Find Nodes?
    Voting Booth?