NativeHashMap slow with big numbers. Bug?

I found a very curious thing. I accidentally made numbers smaller in a NativeHashMap. Suddenly my code ran waaaay faster. The speedup came from a function that does a lot of hash checks. So now I’ve rewritten some code to scale my values up and down, which feels odd…

Does anyone know more about it? Why is this?

Bump. This is still happening. I get 30 times faster hash checks by adding x*0.01 before adding to my NativeHashMap. :hushed:

if you have a lot of hash collisions, the collection could be a lot slower, multiplying it must be reducing those hash collisions - it’s not about the actual size of the numbers

1 Like

Ok! I’m using hash to check for duplicate vertices. So that would mean that I’m getting hash collisions for different float3s between 0-100 in magnitude, and less hash collisions between 0-1. Weird.

Thanks for clearing that up!