Benchmarking Box2D Based Physics Engines

With the help of Paril - the developer of Box2C - I've made a benchmark of the following engines:

I were quite surprised by the findings, so I decided to post them here.

I benchmarked the different engines using the Pyramid test from the Box2D Testbed. We used a pyramid base count of 35 that resulted in 630 stacked boxes at once. We found that higher base count resulted in too much breakup in the pyramid in the engines based on Box2D 2.2. I started the tests and waited for the solver to converge and the timer output became steady. I repeated this several times to make sure the results were consistent.

Test system

2 x Quad core Xeon 2.33 Ghz 1333 Mhz FSB
Geforce 7900 GT 256 Mb RAM

Running Windows 7 64Bit with as few applications as possible.

Box2D Settings

Velocity iterations: 8
Position iterations: 3
CCD: Enabled
Sleeping: Disabled
Warmstarting: Enabled

Rest of the settings are the Box2D defaults.


jBox2D rev 261 trunk (Fastmath = false to the right)

jBox2D-rev 261 trunk-Converged jBox2D-FMathOff-Converged

Box2D 2.2


Box2D 2.1.2


Box2C rev 20


Farseer Physics Engine 3.2



Engine: Time Notes
jBox2D rev 261 11/12 ms Unstable pyramid when fastmath was set to true – I clocked it at 11 ms.
Some boxes fell of the top and fell outside the screen. With fastmath = false,
the simulation was a bit more stable, but also a bit more wobbly.
Turing off fastmath resulted in 1 ms slower simulation (total: 12 ms)
Box2D 2.2.0 8 ms  
Box2D 2.1.2 10 ms Simulation seems more rigid than Box2D 2.2.0 and the pyramid looks perfect.
Box2C rev 20 13 ms 3 ms slower because of the overhead of being a C# wrapper.
Farseer Physics Engine 3.2 6 ms  


Farseer Physics Engine 3.2 is by far the fastest of the engines, which might seem a little odd considering it is a direct port of Box2D 2.2.0 and written in C#. However, due to the heavy manual optimizations done to the collision system, it manages to be even more efficient than the original Box2D library. I’m not sure how different jBox2D is from Box2D 2.2 seeing as it produces different results from the rest of the engines, but 11-12 ms is a pretty good result considering it is written entirely in Java.


Anonymous said…
Hello, sir! This comparison is enlightening, however, I am wondering what the best choice to use in C# is right now. Is box2C out of date? Can I run the latest version of Farseer Physics Engine without XNA or Silverlight? If so, how?

Thank you, and good day.
Genbox said…
I'm not sure how up to date Box2C is at the moment. The latest Farseer Physics Engine can be run without XNA or any other libraries. All you have to do, is to download the library (Farseer Physics Engine 3.3.1 Class) and reference it in your project. That should be it.

Popular posts from this blog

Reducing the size of self-contained .NET Core applications

.NET Compression Libraries Benchmark

Convex polygon based collision detection