MT support in Farseer?

Topics: Developer Forum
Sep 17, 2010 at 3:27 PM

I'm curious what plans if any there are for enabled Farseer Physics to take advantage of multiple cores? This seems like a logical step to really boost performance and I'm wondering what thoughts have gone into this? 





Sep 17, 2010 at 4:00 PM

I tried it in older versions of Farseer Physics Engine (2.1 and lower), but the results were far from satisfying. The overhead of doing the multithreading was simply more than the peformance gain of running on two or more cores.

I know it has been tried on prelease versions of FPE 3.0, but I'm not sure how much the engine gained from it. I usually tell people that when working with high performance libraries such as game libraries, we don't get more performance from MT, but we can scale up the workload that the library can handle.

If the engine completes a full step in 10 ms and it takes 5 ms overhead for the MT, then we will have lost 5 ms to the overhead. But if we can handle double the number of bodies (using 2 cores) in 10 ms, then we would have gained from it. So far, all attempts to make the engine faster using MT has proven to be difficult and the performance gain has been negligible. I recommend that people implement the engine to run in a thread by itself and the rest of the game in another thread.