Understanding Testbed profiling (using DumpShell.h)

I have various compound shape bodies made of small bodies connected together with joints.
Because I have a large number of bodies I am experiencing performance problems on iOS devices.

I dumped the world using world->Dump() into DumpShell.h in the Testbed so I can see the Profile and Statistics. I'm using the default iteration numbers 8, 3 both in the testbed and in the actual game.
Can someone help me understand what this means? Please see the image below

Image

Based on this, I would like to know what's going on and what can I do to optimize things. Any help is much appreciated!

EDIT: Erin was saying something about tweaking the compiler settings, such as enabling SSE, disabling exceptions, and using fast floating point math in another post.
I guess using [-Os] optimization level in Xcode means fast floating point math, but I'm not sure what "enabling SSE" means and if I can use it to improve performance?!
How many bodies do you have? How many are on screen? What are you using to render the bodies?
http://stackoverflow.com/questions/1622729/double-vs-float-on-the-iphone/1622786#1622786
I currently have 218 bodies as you can see in the image. All of them are on screen. I'm using OpenGL to render things but I don't think this is relevant.
Disable the glDrawElements (or equivalent) to confirm this theory. If you are doing 218 unique draw calls, GL very well could be at fault. I am pulling these numbers out of relatively thin air, but you should be shooting for no more than 40-80 draw calls per frame. Are you drawing a quad per object? Have you already combined their textures into an atlas?
Also, there is a OpenGL Performance detective (not instruments), that was actually quite helpful in quickly identifying whether or not my app was GPU or CPU limited.
OpenGL is pretty optimized, I'm using VAO to draw around 100 bodies. So I only have a few draw calls.
I was reading about floating point optimization and it looks quite interesting. Haven't found a clear answer though to Erin's recommendation about enabling SSE and tweaking compiler settings.
So I'm not yet sure if I can do this in Xcode, if I have to do it, or if it will improve box2d performance.
Are you on XCode 4? Did you run the OpenGL Performance Analyzer tool from XCode? It doesn't take any code side instrumentation to use.
Yes, I did try that. I also ran the world without any visuals drawn, so I only had "invisible" box2d bodies, and I was still experiencing same performance issues.
So I'm sure I need to somehow optimize box2d not opengl.
See what instruments says, but I suspect that the problem is the joints. Normally, Box2D has to crunch lotsa numbers when many object pairs require narrow phase collision detection and in the case of joints, no configuration of objects are going to prevent the joint iterations from being performed.

400+ joints is quite a few.

You can use collision filtering and joint collision filtering to cut out unnecessary calculations. Is that already being done?

Lastly, if you are CPU limited, confirm with the profiler that it is really Box2D at fault. I have very thin wrappers that transmit data from the iOS sdk for things like touch positions and setting up a GL view, and then I don't mess with Objective C. Cocos2D will cripple what you can do because of Objective C. OBJC is a complete CPU hog. I'll check back in a few hours, going to a social event now that my workday is over and if you can provide feedback I'll tell you everything that I can think of.

If I am interpretting that image correctly, your slow performance has nothing to do with an unbalanced b2DynamicTree in your b2World. 10 is a very reasonable height.

RopeBurn has at least one level with over 10,000 b2Bodies and over 50,000 b2Fixtures, so I know what you are trying to do can be accomplished. Perhaps this is anomalous, but I found a performance increase from switching to double precision math for the physics. I posted that stackoverflow link earlier because it was an opposing viewpoint, but in my case I suspect that I might be seeing what I saw years ago on the PC. Many FPUs have a very poorly optimized hardware for floating point underflow and double precision floats get much much smaller before they reach underflow. Just another angle for you to consider when the profiler tells you what is going on.

Original thread: https://box2d.org/forum/viewtopic.php?t=8177