Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
1761755d4d
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. |
||
---|---|---|
.. | ||
src | ||
build.gradle |