Large Disclaimer :-
- I have never used multi-thread for both Physic Engine.
- I have never used them to create the same application either, because one is 2D, another one is 3D.
- I will answer from my past memory instead of benchmark them. I accept that it is not a good practice.
If I have to simulate ~100 amount of bodies (2D-rectange in JBox2d, 3D-cube in Bullet) :-
- C++ compiled with Release mode (optimization turn on)
- Java compiled with Release mode (not debug mode), using
ctrl+F11
Eclipse
- Computer is not in a stress condition (minium program opened)
- No constraint (joint for Box2D, btConstraint in Bullet) for both Physic Engines.
- Body are scattering around (sometimes collide with each other), no stacking.
- All bodies are not too far away. All with in 1 screen, roughly speaking.
- I have some game logic, but not too heavy.
- C++ program is coded well in C++ style (not abuse
new/delete
, share_ptr
much)
- Windows 7 with specification that can play most current PC games (2017).
I can expect C++ & Bullet
-program run faster than Java & Box2D
around :-
3 times (quite conservative) - 10 times (common).
Edit:-
I have just remembered a real test case in my old computer a few years ago.
When I ran 400 rectangles in JBox2D
, I could barely reach 60 fps with 10-30% CPU in Physic's part .
However, I could add around 4000 cubes in C++ Bullet
, and I can get around 60 fps with 10-30% CPU in Physic's part (profiled).
(I note 10-30% because I can't remember the exact number.)