[ODE] dNormalize3 speedup
Oles V. Shishkovtsov
oles at gsc-game.kiev.ua
Thu Jun 3 14:29:53 MST 2004
Hello,
Can somebody who has access to CVS add following snipped to
"odemath.cpp", line 37 (the start of the function).
This is a faster sequence for normalizing vectors which has "normal"
magnitude, not the extremely small one. The old behaviour remains the
same for problematic cases.
According to our profile this small function is in top-20, during
stress-testing. Adding following removes it from profile completely.
--------------------------------------------------------------------
dReal sqr_magnitude = a[0]*a[0] + a[1]*a[1] + a[2]*a[2];
dReal epsilon = 1.192092896e-05F;
if (sqr_magnitude > epsilon)
{
dReal l = dRecipSqrt(sqr_magnitude);
a[0] *= l;
a[1] *= l;
a[2] *= l;
return;
}
--------------------------------------------------------------------
--
Best regards,
Oles V. Shishkovtsov
GSC-Game World
oles at gsc-game.kiev.ua
More information about the ODE
mailing list