3D and floating point optimization

Simon Wittber (Maptek) Simon.Wittber at perth.maptek.com.au
Tue Jan 21 05:25:18 CET 2003

>>My question is, considering the speed of today's FPUs, is using fixed 
>>point math still a valid optimization, in Python?

>Using fixed-point to represent floating point wouldn't be the first
place I'd
>look for optimisation.  

If fixed point (considering modern FPU speed) still speeds calculations
it's the sort of thing you have to do first. While I haven't done this
I think it would be a pain to retrofit.

>Extensive use of Numeric Python whereever possible, binding core-code
>psyco, liberal use of display-lists (preferably with a dynamically
>compilation) and/or array-based geometry, and traditional Opengl
>strategies (aggressive scene culling, state-change minimisation) will 
>probably get you farther faster.

I'm already using these techniques. I have to say, Psyco is marvelous!

>AFAIK, Numeric Python doesn't do any parallelisation tricks for e.g. 
>3DNow or SSE, so adding extension support for using those for 
>array-proccessing (normal calculation or the like) would probably give

I also am pre-calculating normals.

>Re-coding a few core loops in C or PyRex would also likely be a decent 
>optimisation approach.  

This prompts another question, is fixed point math still a valid
in C? If so, Pyrex code could be a good option.

I suppose I could I could code up some quick benchmarks comparing floats
fixed points, but I am interested in other peoples experience.


More information about the Python-list mailing list