Use LocalVector in Animation#101285
Conversation
c728d8a to
94bc137
Compare
61c912d to
9da63e2
Compare
|
I tested this with the MRP from #101494 on an M2 MBP. It improved frame time by about 0.1 ms (10.8 -> 10.7) However, there was enough fluctuation that this observed difference could have been a measurement error. That being said, I am inclined to believe that there was an improvement since Vector showed up in a few places in my earlier profile. I suspect that the larger cost is the allocations rather than the CoW semantics, so this is only showing a small improvement. |
clayjohn
left a comment
There was a problem hiding this comment.
This is a great effort. None of these needed the CoW semantics, so we were just wasting a lot of effort.
It looks like a lot of code changes, but its just the necessary renaming for switching from Vector to LocalVector.
The only other change is a few places where we switch from checking if (some_int <0 || some_int > max_value) to if (uint32_t(some_int) > max_value) i.e. relying on integer overflow to avoid a check.
Can you rebase? I think this could be merged during the beta cycle
9da63e2 to
1009da6
Compare
|
Looks like it is failing checks on a signed/unsigned comparison |
673a223 to
9ee04ea
Compare
Does this measurably impact performance? IMO that worsens readability / communication of the intention of the code. |
|
EDIT : I thought this would be no different either way, but it turned out to not be the case, see below, the behaviour is different depends on the sign, and whether the value is a constant, the compiler will only do the trick under specific circumstances. https://godbolt.org/z/nTcf86Kos c++: assembly: |
|
@lawnjelly Compilers don't know this trick if |
9ee04ea to
df7835a
Compare
Good point actually. Also on further testing, turns out they also can't do the trick if So for it to be confident of the trick I think it has to be sure that both the value and the size are unsigned, otherwise all bets are off it seems. |
df7835a to
1964918
Compare
|
Thanks! |
Closes: godotengine/godot-proposals#10594
Replaced only those that are often used by the animation system.
Number of
get/_copy_on_writecalls in tps-demo every 5 seconds:I will make benchmarks later.