Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Small Hash a Gateway to Large Hash?

by dsheroh (Monsignor)
on Feb 18, 2014 at 09:36 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1075302]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found