In TSegment there were two different formulas for a derivative. Most places called GetFirstDerivative() that used the direct formula from the curve points. However RaPositionGet() had its own calculation based on pre-computed cubic polynomial coefficients. This latter method is faster and simpler, so change GetFirstDerivative() to use it and change RaPositionGet() to just call GetFirstDerivative().
TSegment::GetTFromS() is a significant hotspot in the non-rendering part of the state_manager update (about 13%). This change introduces a FastGetTFromS() version that interpolates from precomputed values instead of doing the whole calculation on every call. Computing position from track distance is now done in constant time. This reduces the contribution to about 0.3%.