[ODE] Re: dRandInt & performance
Aras Pranckevicius
nearaz at gmail.com
Mon May 16 18:22:12 MST 2005
> On my PS2 build replacing dRandInt with a simple inline
> custom randomInt function (see later) improved for me
> performance of the solver over 200%.
> I'm not sure what the performance gain is (if any) on an
> Intel type of platform I haven't profiled that. I would guess
> that if not for the double the an inline func will reduce the
> overhead of calling library rand() function at least.
For one, dRandInt() uses dRand(), and that doesn't call standard
rand(), but uses the same type generator as your function (just
different primary numbers).
That said, it does quite unnecessary int->double->int computations,
and is not inline.
In my current project (on x86), in one physics (but not collision)
heavy scene I've also noticed that dRandInt() takes ~3% of total app
time (quite much for such a tiny thing!). Replacing it in quickstepper
with inline function as you said made it disappear from profile, and
FPS in the worst case got up a bit.
--
Aras 'NeARAZ' Pranckevicius
http://nesnausk.org/nearaz | http://nearaz.blogspot.com
More information about the ODE
mailing list