3D and floating point optimization
Erik Max Francis
max at alcyone.com
Tue Jan 21 07:27:36 CET 2003
"Simon Wittber (Maptek)" wrote:
> Many years ago, using fixed point numbers to speed up calculations
> in the demo-scene) was a standard optimization, which would speed up
> code by orders of magnitude.
> I have been experimenting with Python+OpenGL and have run into a few
> speed bumps.
> My question is, considering the speed of today's FPUs, is using fixed
> point math still a valid optimization, in Python?
Probably not. With dedicated FPUs, floating point operations tend to
outperform fixed point operations, but the details really depend on
precisely what you're up to. For instance, if your FPU natively uses
doubles instead of floats (C terminology, not Python), then doing
calculations with floats instead of doubles may actually be _slower_
because of the implicit conversions that have to take place.
Chances are that in a modern, real-world application, using fixed point
would be unlikely to help. At the very least do some profiling first so
you have some quantitative data about exactly where the bottlneck is; it
may not in fact be anywhere near where you initially thought.
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ To be refutable is not the least charm of a theory.
\__/ Friedrich Nietzsche
REALpolitik / http://www.realpolitik.com/
Get your own customized newsfeed online in realtime ... for free!
More information about the Python-list