I'm currently doing an optimization run on JBox2d, I decided to run a couple of speed tests with the Box2d versions I'm most comfortable with, Java and C++, to get an idea of relative performance and measure how effective my optimizations are. I coded the same test in Java and C++, which would look like this if graphics were displayed, which they are not (to get a better sense of the pure library performance):

The piston just keeps pumping, so things never settle down. Each test runs for 1000 physics frames. This is a decent test of the contact handling, but not of joints; I'll probably make another benchmark using those later, but for now I'm seeing most of the bottlenecks in the contacts, so...
Here are the details if you're curious to run the tests yourself:
Java file: http://www.jbox2d.org/jbox2d-2.0.1-speedTest.jar
Instructions: Download the .jar, and browse to the directory in the command prompt/shell (don't double click the .jar, because though it is executable, you likely won't see the console output or be able to specify JVM flags), and run it with the command "java -jar -server -Xms128M -Xmx256M jbox2d-2.0.1-speedTest.jar 40" (without the quotes). If you change the flags to -Xms1024M and -Xmx2048M you'll probably get slightly higher performance, but allowing a 2 gigabyte heap is just ridiculous, even for Java...
C++: Download the attached SpeedTest.cpp file, and do whatever magic it is on your system that adds a C++ file to the Box2d project (which you must have, also), then run it! Sorry, I'd provide executables, but I'm on a Mac, and I don't think a Mac binary would help too many people.
I'm curious to see what other people get - it would be useful to know your system details, including what JVM you're running.
My results (OS X 10.5.3, Intel 2.4 gHz w/2 gig RAM, Apple's Java 1.6):
Java average FPS: 568.03015
C++ average FPS: 708.61
...which shocks me a little bit, I expected a much larger difference between Java and C++ (and saw one before I optimized, which means my work paid off - on this test, with a couple hours work I was able to bump up performance by a full 100 fps). The caveat being, of course, that it takes a LOT of work to squeeze the performance out of Java, and I think this is about as good as can be done, whereas the C++ version hasn't needed much tweaking because it's fast enough already. Also, note that with a 1.5 JVM, I only get ~450 fps for the Java version. You lose another ~100 fps by not using the -server flag, too. I haven't checked this on Windows or using Sun's JVM, which is pretty important since that's what most people use...
I did not do an Actionscript version of this because I have no idea how to run AS3 code without the whole graphics thing being active, and it seemed unfair to do the Java and C++ ones as console programs and then compare that to an AS3 one with the graphics output slowing things down. Maybe an AS3 expert has an idea how to get a good sense about to decouple the library timing from the graphics?

The piston just keeps pumping, so things never settle down. Each test runs for 1000 physics frames. This is a decent test of the contact handling, but not of joints; I'll probably make another benchmark using those later, but for now I'm seeing most of the bottlenecks in the contacts, so...
Here are the details if you're curious to run the tests yourself:
Java file: http://www.jbox2d.org/jbox2d-2.0.1-speedTest.jar
Instructions: Download the .jar, and browse to the directory in the command prompt/shell (don't double click the .jar, because though it is executable, you likely won't see the console output or be able to specify JVM flags), and run it with the command "java -jar -server -Xms128M -Xmx256M jbox2d-2.0.1-speedTest.jar 40" (without the quotes). If you change the flags to -Xms1024M and -Xmx2048M you'll probably get slightly higher performance, but allowing a 2 gigabyte heap is just ridiculous, even for Java...
C++: Download the attached SpeedTest.cpp file, and do whatever magic it is on your system that adds a C++ file to the Box2d project (which you must have, also), then run it! Sorry, I'd provide executables, but I'm on a Mac, and I don't think a Mac binary would help too many people.
I'm curious to see what other people get - it would be useful to know your system details, including what JVM you're running.
My results (OS X 10.5.3, Intel 2.4 gHz w/2 gig RAM, Apple's Java 1.6):
Java average FPS: 568.03015
C++ average FPS: 708.61
...which shocks me a little bit, I expected a much larger difference between Java and C++ (and saw one before I optimized, which means my work paid off - on this test, with a couple hours work I was able to bump up performance by a full 100 fps). The caveat being, of course, that it takes a LOT of work to squeeze the performance out of Java, and I think this is about as good as can be done, whereas the C++ version hasn't needed much tweaking because it's fast enough already. Also, note that with a 1.5 JVM, I only get ~450 fps for the Java version. You lose another ~100 fps by not using the -server flag, too. I haven't checked this on Windows or using Sun's JVM, which is pretty important since that's what most people use...
I did not do an Actionscript version of this because I have no idea how to run AS3 code without the whole graphics thing being active, and it seemed unfair to do the Java and C++ ones as console programs and then compare that to an AS3 one with the graphics output slowing things down. Maybe an AS3 expert has an idea how to get a good sense about to decouple the library timing from the graphics?