Analysing execution time

I have an OF007 project which uses the MSAPhysics library, plus it’s dependencies (MSACore and MSAObjCPointer). I have the program running smoothly at ~40fps on my MacBook Pro. When I’ve tried to move it to my Windows machine using VS2010, however, it runs very slowly, and gets progressively slower the longer it runs. It looks much nicer though, thanks to the far superior GPU! I did have to add some extra header files to the MSACore library, which I found on a forum thread here.

I did some primitive debugging, commented out as much as possible, and discovered that stopping the physics from updating made it run at ~60fps. However I have no idea which part of which library is causing the slowdown, since the physics lib depends on so much else. Is there any way of establishing how long each function in the heirarchy takes to run?

just in case - have you checked RAM usage? The slowness creeping in over time is often an indicator.

I’ve had a look using the Windows resource monitor and it doesn’t seem to be increasing the amount of RAM it’s using.

The call that seems to be making the difference is update() from the Physics instance. If I put that in an if statement I can switch it on and off- when it’s off the program runs at ~50fps; when I turn it on it plummets; but I can turn it back off the framerate immediately returns to it’s previous level.

OK, I’ve rebuilt the project using Code::Blocks, where it runs at 60fps with physics off and a steady 10fps with them on- it doesn’t seem to degrade like the VC++ version does. This at least makes sense to me (I think I’m doing too much on the CPU that should be on the GPU) but I’ll need to figure that out.

Suggestions still welcome if anyone knows why it behaves oddly with VC++ but I’ll stick with Code::Blocks for now.

I’m guessing it’s not the compilers, but I’m wondering if there are some compiler flags set in VS projects by default that aren’t playing nicely with the library? Do you have any of the optimzation flags set, i.e. /O flags, set as described here ?


just a silly question: do you test release builds or debug-builds? Debug-builds with Visual studio are slow as hell.


Joshua, I don’t think I’ve changed any of them. Reset to what seem to be the defaults and that makes no difference I can see.

sth, that’s a big help- switching to the release build makes it run at a steady 13fps and doesn’t degrade (so about the same as Code Blocks). Still not sure why it’s so much faster on the Mac- maybe just better single thread performance on Intel vs my AMD desktop.

Cheers folks.