[ODE] ODE in its own thread

Frederic Ferland fref at videotron.ca
Thu Jul 17 20:40:02 2003


I am experimenting with my ODE-enabled application to try increasing its 
performance.  I am trying to run the physics in one thread and the rest of 
the program (mainly Direct3D rendering for now) in another one.  I was 
running everything in the same thread before.

Multi-threading obviously implies synchronization issues, which add 
complexity and overhead to the code.  As a quick test to see if it was 
worth the trouble in the first place, I tried creating a very simple thread 
that only handles the world stepping with no synchronization (ie: no 
WaitForSingleObject() calls, no critical sections, etc...) at all between 
the two threads.  To my surprise, I do not get a performance increase from 
the multi-threading.  And since I am not doing any synchronization yet, 
synchronization is not slowing things down.  I was kind of expecting a 
performance boost, but I get the exact same frame rate as I was getting 
with everything running in the same thread.  At least it's not slower, but 
still I am really surprised!

Anyway, I was just wondering if anyone has tried implementing physics using 
multi-threading and if so, how did you implement it in order to obtain a 
performance boost from it.  Is this worth the trouble or should I just 
stick to the simple way of doing things? :)

Thanks for any advice!