jdawg3636 / ICBM

Port of the classic ICBM mod to modern versions of Minecraft
https://discord.gg/UrVw6NJD24
MIT License
8 stars 2 forks source link

Improve BlockPos hashCode performance #2

Closed kmecpp closed 2 years ago

kmecpp commented 2 years ago

This is the standard way to produce a hashCode with a good distribution. See java.util.Arrays.hashCode()

kmecpp commented 2 years ago

Noticed after I submitted the PR that it was only being used for randomness. Updated to make it more random. Still ~5x faster than the original code with the cryptographic hash

jdawg3636 commented 2 years ago

The SHA1 function definitely needs replaced (unrelated to this is that the sorting algorithm that it's used by should probably be run on the manager thread rather than in the post-completion function). A couple of issues with your current solution:

If you can fix the rotational symmetry issue then I'd be happy to merge this 👍

jdawg3636 commented 2 years ago

Closing - stale.