On my Phenom II desktop machine (about 3 years old) with 8GB of RAM, it seems that I can only throw around a hundred or two boxes before it starts to go slow. I'm using the built-in DbvtBroadphase.

Is this about right, or am I missing something?

One thing that can't possibly be right though is that it takes several minutes to delete all the bodies (the RigidBodies, to be exact), spending nearly all of its time in HeapFree.

By the way I'm using BulletSharp, but I'm only making one call to the native API each frame -- which suggests that it's not the fault of the wrapper that it's so slow, unless there's something really weird going on with it.

Edit: It seems that there's a threshold point after which the program's memory consumption just starts skyrocketing. Something's leaking. Still, I'd be interested to know what to expect in a normal situation.


1 Answer 1


Look at the benchmark demo in the bullet installation folder: bullet/Demos/Benchmarks. I just checked benchmark 4, it creates 960 bodies and collides them, you can adjust the numbers in the demo of course. All timings and statistics are rendered on the screen in the demo, answering all your questions.

Just run a quick test using that demo on my machine: 400 bodies colliding with less than 6ms per simulation call, change this function in BenchmarkDemo.cpp to get 400 bodies:

void    BenchmarkDemo::createTest4()

    int size = 8;
    const float cubeSize = 1.5f;
    float spacing = cubeSize;
    btVector3 pos(0.0f, cubeSize * 2, 0.0f);
    float offset = -size * (cubeSize * 2.0f + spacing) * 0.5f;

    btConvexHullShape* convexHullShape = new btConvexHullShape();

    btScalar scaling(1);


    for (int i=0;i<TaruVtxCount;i++)
        btVector3 vtx(TaruVtx[i*3],TaruVtx[i*3+1],TaruVtx[i*3+2]);

    //this will enable polyhedral contact clipping, better quality, slightly slower

    btTransform trans;

    float mass = 1.f;
    btVector3 localInertia(0,0,0);
    int counter = 0;
    for(int k=0;k<25;k++) {
        for(int j=0;j<2;j++) {
            pos[2] = offset + (float)j * (cubeSize * 2.0f + spacing);
            for(int i=0;i<size;i++) {
                pos[0] = offset + (float)i * (cubeSize * 2.0f + spacing);
        offset -= 0.05f * spacing * (size-1);
        spacing *= 1.01f;
        pos[1] += (cubeSize * 2.0f + spacing);
  • \$\begingroup\$ Thanks, not sure why I never thought to check the demos. \$\endgroup\$ Jul 16, 2012 at 22:51
  • \$\begingroup\$ I would love to hear the results of the benchmark \$\endgroup\$
    – ManicQin
    Jul 17, 2012 at 7:50
  • \$\begingroup\$ @ManicQin I said it in my answer: 400 bodies -> less than 6 ms per simulation step on a 2 year old PC, don't have the CPU details available right now \$\endgroup\$ Jul 17, 2012 at 17:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .