Performance of TrueSync types

We are seeing severe performance issues with even the most basic operations of moving units around and other operations that involve vector or quaternion maths.
Therefore I did some timings on the performance of the TrueSync types, specifically TSVector and TSQuaternion, to see how the compare to their Unity counter parts.
  • Normalizing a TSVector is over 20 times slower than a Vector3.
  • Adding two TSVectors is about 7 times slower than adding Vector3s.
  • Instantiating a TSVector is 3 times slower than a Vector3.
  • Doing the dot product of two TSVectors is over 20 times slower than for Vector3s.
  • Doing the closest to Quaternion.LookAt (TSQuaternion.CreateFromMatrix(TSMatrix.CreateFromLookAt(...)) is over 50 times slower than Quaternion.LookAt.
This is a massive problem to us since, as mentioned, even the most basic operations quickly use up the entire frame budget.
What are your thoughts on this?

Answers

  • Hi @Geminior, thanks for the report and the comparation with Unity's correlated functions. Basically for all math operations we wil always have a slower perfomance, because we do this calculation with fixed point arithmetics to have a deterministic result on every client connected. We plan to improve our math side but we have to take determinism in mind.