Physics engine benchmark ideas. - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Physics engine benchmark ideas. (/thread-8676.html)
Physics engine benchmark ideas. - Skorche - Feb 24, 2011 02:20 PM
Usually when doing performance testing on Chipmunk I just run time trials of whatever random demos I currently have in my demo application. For years I've thought that I really should make some proper benchmarking scenes, but have never really gotten around to it. Yesterday I finally started. So far I have these:
Lots of circles or boxes interacting with a simple rough static terrain (48 line segments):
Tested with constant sized circles, 1000, 500, and 100 count.
Tested with constant sized boxes, 1000, 500, and 100 count.
Tested with variable sized circles, 500 count.
Tested with variable sized boxes, 500 count.
The idea here is mostly to test the speed of the solver and general collision detection algorithms. Objects quickly settle to their final places and don't move much afterwards.
1000 frictionless circles interacting with a complex static terrain (262 line segments):
Similar to the first benchmark, but encouraging objects to move more. The balls fall into the basin and fill the tunnels.
500 perfectly elastic circles interacting with a complex, high resolution, static terrain (516 line segments):
Stress test the collision detection with moving objects. With no persistent contacts, the solver should take up very little of the CPU time.
28 moving circles moving through a grid of 825:
The moving circles bounce off the edges of the screen, but otherwise collisions never occur. More stress testing of the collision detection, but this time making sure that it's good at filtering out false positives.
Does anybody have other ideas of common physics usage that should be benchmarked? Also, anybody know what to use in place of gettimeofday() on Windows?.
RE: Physics engine benchmark ideas. - AnotherJake - Feb 24, 2011 02:59 PM
(Feb 24, 2011 02:20 PM)Skorche Wrote: Also, anybody know what to use in place of gettimeofday() on Windows?.
You could try something like this (I don't recall if I have actually tested/used it yet, but it's in my codebase, so maybe it works?):
RE: Physics engine benchmark ideas. - OneSadCookie - Feb 24, 2011 03:02 PM
BTW, gettimeofday isn't best for either Mac or Linux, though it at least works on both. mach_absolute_time for Mac, and... uh... ask ThemsAllTook for Linux XD
RE: Physics engine benchmark ideas. - AnotherJake - Feb 24, 2011 03:04 PM
I think it's clock_gettime() for Linux.
RE: Physics engine benchmark ideas. - Skorche - Feb 24, 2011 03:50 PM
Oh? gettimeofday() seems to be pretty accurate to the sub-millisecond level. I guess I'll have to write an #ifdef for the time function anyway. Might as well use mach time.
RE: Physics engine benchmark ideas. - AnotherJake - Feb 24, 2011 04:14 PM
It's plenty accurate, but gettimeofday isn't monotonic on the Mac since it is based on "wall clock" time, which can be updated/changed automatically, when you don't expect it to. I got slapped for this and use mach time now instead.
I just remembered ThemsAllTook posted his cross-platform time func not too long ago, here, which looks pretty good (in fact, that looks like where I got my Windows function I posted above).
RE: Physics engine benchmark ideas. - Skorche - Feb 28, 2011 06:36 AM
To anybody that's interested in a Box2D performance comparison.
I'm pretty happy with that. I guess all that time I spent optimizing the solver and collision detection paid off.