Starting in on Switch... kill map in defrag queue, which will probably improve performance pretty decently under high load with lots of peers.

This commit is contained in:
Adam Ierymenko 2015-09-04 14:44:22 -07:00
parent f116c4b9c0
commit 0ab3e49be9
3 changed files with 35 additions and 27 deletions

View file

@ -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()