Re: physic engines speed tests

2008-03-18 Thread Chris Hager
Hey,

I've now done speed tests with rectangles instead of balls, and here 
box2d is performing even better. 
http://wiki.laptop.org/go/Physic_Engines/Speed_Tests


Jeremy Fitzhardinge wrote:
 Chris Hager wrote:
 Hey all,

 Josh and I now made some speed tests with both 2D physics engines - 
 Box2D and Chipmunk - and here are some results. One warning though: 
 The tests were made with Python, and for Box2D there's a library 
 compiled with swig, whereas Chipmunk's interface is done with ctypes. 
 This may change the results to Box2D's advantage, but is justifiable 
 as our interest right now is which performs better with Python and on 
 the xo laptop.

 In the end, Box2D performs quite a bit better than Chipmunk, although 
 it has a ways larger library and many more functions. On a XO Laptop 
 (build 650), the Box2D engine can easily handle 50 elements - almost 
 twice what we got from Chipmunk.
   

 Have you done any profiling to see where the time is going?  I did 
 some investigation about how hard it would be to make Chipmunk use 
 3dnow to get some vectorization; I came to the conclusion that it was 
 definitely possible if it helps any of the hotspots.  But I haven't 
 measured to see where the time is going.

After studying the test results, the hotspot definitely is the drawing 
with pygame. If you simply disable the pygame drawing things, the speed 
multiplies by 2 or 3.
On my machine, the pygame drawing get's really slow at around 200 
elements, on the xo laptop, the framerate drops below 30 with ~ 50 balls 
or 18 polygons. Just with the physic calculations and without the 
drawing, box2d has full performance (40fps), which only drops with  60 
polygons.

 But as you suggest, my suspicion is that a lot of the time is being 
 lost in the python binding, and a higher-level interface would allow 
 it to perform better.

I think with SWIG it's maybe the most we can get out of it.

 How do the physics models themselves compare?

The only difference I noticed so far is that Box2D calculates in MKS 
(meter-kilo-seconds), and we have to do the translation to pixels by hand.

J


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: physic engines speed tests

2008-03-18 Thread Chris Hager
Joshua Minor wrote:

 On Mar 18, 2008, at 9:48 AM, Chris Hager wrote:

 How do the physics models themselves compare?

 The only difference I noticed so far is that Box2D calculates in MKS 
 (meter-kilo-seconds), and we have to do the translation to pixels by 
 hand.

 I have noticed that Chipmunk never seems to settle all the way, it 
 stays jittery even when nothing should be moving.  Box2D only gets 
 jittery when objects are under a lot of pressure.  Also, Box2D now 
 supports a flag to enable continuous collision detection.  This can 
 prevent high velocity objects from tunneling through thin objects.

The not settling thing is a problem with chipmunks elasticity settings - 
elements only stop moving if it is set to 0.0.

Also I noticed, that Box2D with SWIG crashed on more than ~ 520 elements.

- Chris


Btw, I've added some graphs to [[Physic_Engines/Speed_Tests]], 
displaying the FPS in relation to the count of elements on a XO-B4 (test 
with circles and with polygons).

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel