Click here to Skip to main content
15,904,153 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jmaida14-Jan-24 15:51
jmaida14-Jan-24 15:51 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
Greg Utas14-Jan-24 18:54
professionalGreg Utas14-Jan-24 18:54 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jmaida15-Jan-24 17:11
jmaida15-Jan-24 17:11 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
Greg Utas15-Jan-24 19:04
professionalGreg Utas15-Jan-24 19:04 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jmaida16-Jan-24 13:42
jmaida16-Jan-24 13:42 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
megaadam14-Jan-24 22:31
professionalmegaadam14-Jan-24 22:31 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
den2k8814-Jan-24 23:52
professionalden2k8814-Jan-24 23:52 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jschell15-Jan-24 4:58
jschell15-Jan-24 4:58 
Use code tags.

jmaida wrote:
what works for you?


Two of your examples use strings as the key. However the first would appear to be a fixed set. You could attempt to optimize based on that set. I have done so in the past to achieve zero collisions.

However micro optimizations based on guessing is a waste of time. Optimize based on profiling the application using realistic data. (My example above for zero collisions was in fact a waste of time.)

If I was using C or C++ I would use an existing library.

Your code example is mixing the hash value with the hash table which works for very limited cases but in general the two should be distinct (thus the library.)

Recalculating the hash every single time might not be ideal. But avoiding that means using a more complex structure.

jmaida wrote:
Substitution for binary tree name lookup that do not require a minimum guaranteed lookup time


I do not understand that statement. Hash table and binary tree are distinct data structures. You can replace one with the other but there are considerations for both which your statement does not make clear to me. I do know that I replaced a complex tree (not a normal binary tree) with a hash table and gained about a 30% speed improvement so perhaps you are referring to something like that.
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jmaida15-Jan-24 11:48
jmaida15-Jan-24 11:48 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
BernardIE531715-Jan-24 5:03
BernardIE531715-Jan-24 5:03 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jmaida15-Jan-24 11:50
jmaida15-Jan-24 11:50 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jmaida15-Jan-24 14:15
jmaida15-Jan-24 14:15 
GeneralRe: Using HASH Tables. Looking for general discussion on this topic. Pin
jschell16-Jan-24 4:35
jschell16-Jan-24 4:35 
GeneralFound this on Reddit, and... Pin
Brisingr Aerowing14-Jan-24 14:19
professionalBrisingr Aerowing14-Jan-24 14:19 
GeneralRe: Found this on Reddit, and... Pin
trønderen14-Jan-24 16:13
trønderen14-Jan-24 16:13 
GeneralBalmy weather we're having Pin
k505414-Jan-24 4:44
mvek505414-Jan-24 4:44 
GeneralRe: Balmy weather we're having Pin
Gary Stachelski 202114-Jan-24 6:17
Gary Stachelski 202114-Jan-24 6:17 
GeneralRe: Balmy weather we're having Pin
Mike Hankey14-Jan-24 6:40
mveMike Hankey14-Jan-24 6:40 
GeneralRe: Balmy weather we're having Pin
0x01AA14-Jan-24 5:52
mve0x01AA14-Jan-24 5:52 
GeneralRe: Balmy weather we're having Pin
Salvatore Terress14-Jan-24 7:42
Salvatore Terress14-Jan-24 7:42 
GeneralRe: Balmy weather we're having Pin
obermd14-Jan-24 8:13
obermd14-Jan-24 8:13 
GeneralRe: Balmy weather we're having Pin
jschell15-Jan-24 5:02
jschell15-Jan-24 5:02 
GeneralRe: Balmy weather we're having Pin
PIEBALDconsult14-Jan-24 7:46
mvePIEBALDconsult14-Jan-24 7:46 
GeneralRe: Balmy weather we're having Pin
Nelek14-Jan-24 8:15
protectorNelek14-Jan-24 8:15 
GeneralRe: Balmy weather we're having Pin
Daniel Pfeffer14-Jan-24 9:26
professionalDaniel Pfeffer14-Jan-24 9:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.