[ODE] Optimization again

Michael Norel minorlogic at yahoo.com
Thu Nov 7 01:16:02 2002


Have a look at ODE sources, and have a quest :

code such this is not very important but calculated
every step and for every object:
............
  for (i=0; i<nb; i++) {
    body[i]->facc[0] += body[i]->mass.mass *
world->gravity[0];
    body[i]->facc[1] += body[i]->mass.mass *
world->gravity[1];
    body[i]->facc[2] += body[i]->mass.mass *
world->gravity[2];
  }
.............
Is this possible to ilolate such a code and optimaze
it ?  I think it will not change often ?

............
// some example for C like style code
  for (i=0; i<nb; i++) {
     //prepare   
    dReal * facc = body[i]->facc;
    dReal   mass = body[i]->mass.mass;
    dReal * gravity = world->gravity;
    // some isolated performance primitives     
    MULTYPLY_BLOCK( facc, gravity, mass, 3 );
    // MULTYPLY_BLOCK( dest, src, multer, counter );
  }
}




__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2