diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-09-04 14:44:22 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-09-04 14:44:22 -0700 |
| commit | 0ab3e49be91ed7a8723c8b58750aef77c01e8d08 (patch) | |
| tree | c8fe1e6b1b2e7c8a41414c6cf1a91af1e638f19d /node/Hashtable.hpp | |
| parent | f116c4b9c05e88130cb7f2970b616f7930c30c6c (diff) | |
| download | infinitytier-0ab3e49be91ed7a8723c8b58750aef77c01e8d08.tar.gz infinitytier-0ab3e49be91ed7a8723c8b58750aef77c01e8d08.zip | |
Starting in on Switch... kill map in defrag queue, which will probably improve performance pretty decently under high load with lots of peers.
Diffstat (limited to 'node/Hashtable.hpp')
| -rw-r--r-- | node/Hashtable.hpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/node/Hashtable.hpp b/node/Hashtable.hpp index 59a57726..29c54838 100644 --- a/node/Hashtable.hpp +++ b/node/Hashtable.hpp @@ -372,9 +372,12 @@ private: } static inline unsigned long _hc(const uint64_t i) { - // NOTE: this is fine for network IDs, but might be bad for other kinds - // of IDs if they are not evenly or randomly distributed. - return (unsigned long)((i ^ (i >> 32)) * 2654435761ULL); + /* NOTE: this assumes that 'i' is evenly distributed, which is the case for + * packet IDs and network IDs -- the two use cases in ZT for uint64_t keys. + * These values are also greater than 0xffffffff so they'll map onto a full + * bucket count just fine no matter what happens. Normally you'd want to + * hash an integer key index in a hash table. */ + return (unsigned long)i; } inline void _grow() |
