3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00
Velocity/proxy
Andrew Steinborn 1761755d4d Add perfect hashing for dense packet registries.
Since we know the set of packet mappings is always fixed, we can avoid dealing with hash collisions by coming up with a perfect hash function for each registry.

The algorithm used is very simple: we add an offset to the original object's hash code, mix the bits around (using fastutil HashCommon.mix()) and make sure the result is always positive before taking the remainder. The algorithm to generate the offset to the hash code (which we call a "key") is usually quick and is sped up by always rounding up to the next power of 2.

With this, we speed up writing out packet data by completely eliminating any need to check for hash collisions.
2021-08-20 03:59:34 -04:00
..
src Add perfect hashing for dense packet registries. 2021-08-20 03:59:34 -04:00
build.gradle Simplify EventTask. Add custom handler support. 2021-05-19 19:16:46 +02:00