#vectors use spookyhash except when they don't

1 messages · Page 1 of 1 (latest)

kindred ridge
#

can you explain?

rancid temple
#

literally the name of the algorithm

kindred ridge
#

i see

#

and that's bad?

rancid temple
#

its not bad, its just slower than a less safe alternatives

kindred ridge
#

ah I see

rancid temple
#

ie if you need 100k hashings per frame it can be an issue

kindred ridge
#

I'm assuming you just read their released c# code to figure it out?

rancid temple
#

no for hashing i checked it in deep profiler

#

speed tests i did myself

kindred ridge
#

i see so you determined what it was based on the speed?

rancid temple
#

it is SpookyHash128() method in deep profiler

kindred ridge
#

lmfao oh

rancid temple
#

literally or something

kindred ridge
#

ok I'm going to see what float2 uses - or at least what it's called and how long it takes

#

I'll ask you when I get the results in ab idk 5 minutes, because if it takes less time that'd be great because I will be doing a bit of hashing and if it can shave off a millisecond or two combined with some other stuff that'd be great

rancid temple
#

hm, discard that

#

my tests were for v3 converted to v2(x,z)

#

raw v3 was slower, obviously, i made wrong conclusions

#

and i drop decimal places

kindred ridge
#

i'll do both vector2 and float2

rancid temple
#

i convert each axis to short, get first/second byte, shove them into array of 4 bytes, then read array as int through memory marshal

#

yeah dont listen, i did that for domain specific task, this has little value outside of it

kindred ridge
#

scrubbing through why can I not find it!?

rancid temple
#

youre on frame 0

#

oh search query

#

no idea, name mismatch

kindred ridge
#

yea ik im on frame 0 in that picture but still

rancid temple
#

yield return wait for seconds

kindred ridge
#

hmm?

rancid temple
#

2 second offset before your ops start

kindred ridge
#

yea. Imma just pause playmode after

rancid temple
#

heh

kindred ridge
#

im sure it still took time, just was less than 0.01ms

rancid temple
#

check float3 and v3

kindred ridge
#

ok. I'm using values (2, 4, 4)

#

less then 0.01ms looks like

rancid temple
#

🤔

#

Single?

#

3 floats?

#

what am i seeing

kindred ridge
#

idk

#

I have deep profiler on

rancid temple
#

so i replicated the test

kindred ridge
#

what version are you in

#

and what version is this in

#

I'm in 2022.3.7, is it possible it was changed?

rancid temple
#

nope it hasnt

#

i wonder if enabled burst or unsafe has something to do with it

kindred ridge
#

were you bursting your code when you profiled it?

#

i mean if it was bursted it should have been way faster

#

thats probably why f2/f3 take longer to get hashcode cus it's meant to be bursted

#

vectors use spookyhash except when they don't

rancid temple
#

haha im so confused HashUtilities.QuantisedVectorHash() is what i saw a normal vector use

kindred ridge
#

did you just call the .GetHashCode function?

kindred ridge