#Evaluating Animation Curve Performance
1 messages · Page 1 of 1 (latest)
only 2 lol
its inside of a blob array, i would expect the memory access to be super fast?
eh? then how could index < length - 2
do i have the wrong understanding
i don't understand while (index < (length - 2) && time > keys[index + 1].time) { ++index; } if keys has length 2
one sec
that's quite a lot of non-vectorizable math here
true
and rather complex
are there any out of the box ones available? for animation curves, that i can author directly
doubt
i mean 20k of that is just a lot; you could probably get a speedup if you soa'd it and then maybe llvm would vectorize it, or maybe you'd have to use burst intrinsics
its not always 2, can be more
but what I personally would try: make an array of 10/20/whatever number of keys from curve. And just use simple lerp inbetween
20k is the nice case, i was thinking 1mill
allthough not sure it'll be much better
i might just use simple functions
i don't really need curves to be honest to calculate utility values
it's just much nicer to work with
my approach does not limit you from using curves though, it just makes it less precise
yeah, i will try that
just as a sanity check you should also use the burstdiscard trick to make 100% sure you're bursted
but i bet it would still be too slow even bursted
whats this?
bottom of the OP here https://forum.unity.com/threads/when-where-and-why-to-put-burstcompile-with-mild-under-the-hood-explanation.1344539/
mystery solved, the animation curve is super performant, its actually the debug logs
lol
damn, i assumed you had deleted that when measuring
nope, i stubbornly thought there was no way some debug logs can be that heavy
my mobs are pretty happy now
@hybrid rapids memory access should not be the problem because he is caching the array index: using the ref int index parameter and it nearly always starts at 0 then binary search is not worth it
As it turned out all theories for why it was slow were wrong, because it was fast 🙂