Update benchmarks (#77)

The large pyramid got larger, not slower.

Renamed b3CreateCompound to b3CreateBakedCompound and added some
comments. There is confusion between run-time compounds and baked
compounds.
This commit is contained in:
Erin Catto 2026-07-12 22:49:25 -07:00 • committed by GitHub
commit d421e45c82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 106 additions and 94 deletions

View file

@ -0,0 +1,9 @@
threads,ms
1,50240.2
2,37216.3
3,31420.6
4,23466.2
5,19266
6,16078.2
7,13874.8
8,12405.8
1 threads ms
2 1 50240.2
3 2 37216.3
4 3 31420.6
5 4 23466.2
6 5 19266
7 6 16078.2
8 7 13874.8
9 8 12405.8

View file

@ -1,9 +1,9 @@
threads,ms
1,1405.95
2,771.262
3,525.161
4,396.555
5,319.261
6,273.429
7,236.346
8,212.377
1,1488.56
2,760.38
3,512.213
4,389.109
5,316.481
6,268.681
7,234.538
8,208.135

1 threads ms
2 1 1405.95 1488.56
3 2 771.262 760.38
4 3 525.161 512.213
5 4 396.555 389.109
6 5 319.261 316.481
7 6 273.429 268.681
8 7 236.346 234.538
9 8 212.377 208.135

View file

@ -1,9 +1,9 @@
threads,ms
1,24484.3
2,13666.7
3,9769.51
4,7573.72
5,6165.49
6,5234.91
7,4569.35
8,4096.21
1,24363.8
2,13463.4
3,9229.2
4,7110.22
5,5784.18
6,4952.28
7,4305.77
8,3859.87

1 threads ms
2 1 24484.3 24363.8
3 2 13666.7 13463.4
4 3 9769.51 9229.2
5 4 7573.72 7110.22
6 5 6165.49 5784.18
7 6 5234.91 4952.28
8 7 4569.35 4305.77
9 8 4096.21 3859.87

View file

@ -1,9 +1,9 @@
threads,ms
1,1776.98
2,887.705
3,611.107
4,477.959
5,393.24
6,338.688
7,301.258
8,272.38
1,2182.19
2,1111.43
3,770.761
4,588.373
5,487.242
6,412.618
7,361.125
8,327.371

1 threads ms
2 1 1776.98 2182.19
3 2 887.705 1111.43
4 3 611.107 770.761
5 4 477.959 588.373
6 5 393.24 487.242
7 6 338.688 412.618
8 7 301.258 361.125
9 8 272.38 327.371

View file

@ -1,9 +1,9 @@
threads,ms
1,9.6721
2,12.2776
3,13.8174
4,15.0718
5,14.2408
6,14.8061
7,15.4252
8,15.7804
1,10.0177
2,12.2186
3,13.1469
4,13.9029
5,14.4534
6,14.2852
7,14.2133
8,14.433

1 threads ms
2 1 9.6721 10.0177
3 2 12.2776 12.2186
4 3 13.8174 13.1469
5 4 15.0718 13.9029
6 5 14.2408 14.4534
7 6 14.8061 14.2852
8 7 15.4252 14.2133
9 8 15.7804 14.433

View file

@ -1,9 +1,9 @@
threads,ms
1,2540.44
2,1220.31
3,813.901
4,609.715
5,497.305
6,413.889
7,361.679
8,319.254
1,2415.01
2,1205.83
3,797.971
4,608.846
5,493.836
6,413.397
7,352.727
8,311.869

1 threads ms
2 1 2540.44 2415.01
3 2 1220.31 1205.83
4 3 813.901 797.971
5 4 609.715 608.846
6 5 497.305 493.836
7 6 413.889 413.397
8 7 361.679 352.727
9 8 319.254 311.869

View file

@ -1,9 +1,9 @@
threads,ms
1,2314.36
2,1306.31
3,932.724
4,735.735
5,610.991
6,529.984
7,478.004
8,442.816
1,2295.15
2,1266.67
3,891.229
4,705.264
5,586.454
6,511.619
7,460.223
8,424.157

1 threads ms
2 1 2314.36 2295.15
3 2 1306.31 1266.67
4 3 932.724 891.229
5 4 735.735 705.264
6 5 610.991 586.454
7 6 529.984 511.619
8 7 478.004 460.223
9 8 442.816 424.157

View file

@ -1,9 +1,9 @@
threads,ms
1,252.889
2,159.521
3,130.152
4,114.981
5,110.742
6,98.8688
7,99.0887
8,99.0417
1,209.402
2,136.201
3,109.042
4,96.4747
5,90.4057
6,86.776
7,84.5495
8,82.5579

1 threads ms
2 1 252.889 209.402
3 2 159.521 136.201
4 3 130.152 109.042
5 4 114.981 96.4747
6 5 110.742 90.4057
7 6 98.8688 86.776
8 7 99.0887 84.5495
9 8 99.0417 82.5579

View file

@ -1,9 +1,9 @@
threads,ms
1,816.219
2,486.479
3,371.869
4,315.809
5,282.72
6,262.329
7,252.624
8,244.159
1,717.735
2,409.163
3,304.326
4,258.89
5,234.893
6,218.016
7,206.416
8,200.162

1 threads ms
2 1 816.219 717.735
3 2 486.479 409.163
4 3 371.869 304.326
5 4 315.809 258.89
6 5 282.72 234.893
7 6 262.329 218.016
8 7 252.624 206.416
9 8 244.159 200.162

View file

@ -1,9 +1,9 @@
threads,ms
1,334.239
2,226.053
3,182.466
4,159.489
5,149.676
6,140.113
7,132.326
8,132.251
1,325.527
2,199.714
3,152.192
4,133.217
5,123.004
6,115.157
7,111.613
8,108.696

1 threads ms
2 1 334.239 325.527
3 2 226.053 199.714
4 3 182.466 152.192
5 4 159.489 133.217
6 5 149.676 123.004
7 6 140.113 115.157
8 7 132.326 111.613
9 8 132.251 108.696

View file

@ -1,9 +1,9 @@
threads,ms
1,30675.7
2,16370.1
3,11431
4,8895.99
5,7391.02
6,6300.97
7,5618.21
8,5073.84
1,27144.2
2,14602.3
3,10240.3
4,8022.88
5,6649.81
6,5770.75
7,5112.17
8,4749.63

1 threads ms
2 1 30675.7 27144.2
3 2 16370.1 14602.3
4 3 11431 10240.3
5 4 8895.99 8022.88
6 5 7391.02 6649.81
7 6 6300.97 5770.75
8 7 5618.21 5112.17
9 8 5073.84 4749.63

View file

@ -777,6 +777,7 @@ B3_API int b3Body_CollideMover( b3BodyId bodyId, b3BodyPlaneResult* bodyPlanes,
* @defgroup shape Shape
* Functions to create, destroy, and access.
* Shapes bind raw geometry to bodies and hold material properties including friction and restitution.
* You may add multiple shapes to a single body. There are no hard limits on shape count per body.
* @{
*/
@ -816,8 +817,10 @@ B3_API b3ShapeId b3CreateMeshShape( b3BodyId bodyId, const b3ShapeDef* def, cons
/// @return the shape id for accessing the shape
B3_API b3ShapeId b3CreateHeightFieldShape( b3BodyId bodyId, const b3ShapeDef* def, const b3HeightFieldData* heightField );
/// Compound shapes are only allowed on static bodies.
B3_API b3ShapeId b3CreateCompoundShape( b3BodyId bodyId, b3ShapeDef* def, const b3CompoundData* compound );
/// Baked compound shapes are only allowed on static bodies.
/// Note: runtime compounds are achieved by adding multiple shapes to a body.
/// Runtime compounds can be dynamic and/or kinematic.
B3_API b3ShapeId b3CreateBakedCompoundShape( b3BodyId bodyId, b3ShapeDef* def, const b3CompoundData* compound );
/// Destroy a shape. You may defer the body mass update which can improve performance if several shapes on a
/// body are destroyed at once.

View file

@ -2407,14 +2407,14 @@ typedef struct b3CompoundDef
int sphereCount;
} b3CompoundDef;
/// The compound version depends on the tree, mesh, and hull versions.
/// The baked compound version depends on the tree, mesh, and hull versions.
#define B3_COMPOUND_VERSION ( 0x830778DB07086EB4ull ^ B3_DYNAMIC_TREE_VERSION ^ B3_MESH_VERSION ^ B3_HULL_VERSION )
/// Meshes used in compounds have limited space for materials. If you have
/// a mesh with many materials, you can use it outside of the compound.
#define B3_MAX_COMPOUND_MESH_MATERIALS 4
/// The runtime data for a baked compound shape. This is a potentially large yet highly optimized
/// The data for a baked compound shape. This is a potentially large yet highly optimized
/// data structure. It can contain thousands of child shapes, yet at runtime it populates
/// into the world as a single shape in the runtime broad-phase.
/// This data structure has data living off the end and must be accessed using offsets.

View file

@ -51,7 +51,7 @@ public:
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
(void)b3CreateCompoundShape( groundId, &shapeDef, m_compound );
(void)b3CreateBakedCompoundShape( groundId, &shapeDef, m_compound );
}
b3World_SetContactRecycleDistance( m_worldId, 0.0f );
@ -138,7 +138,7 @@ public:
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
(void)b3CreateCompoundShape( groundId, &shapeDef, m_compound );
(void)b3CreateBakedCompoundShape( groundId, &shapeDef, m_compound );
}
~CompoundSpheres() override
@ -212,7 +212,7 @@ public:
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
(void)b3CreateCompoundShape( groundId, &shapeDef, m_compound );
(void)b3CreateBakedCompoundShape( groundId, &shapeDef, m_compound );
}
~CompoundHulls() override
@ -297,7 +297,7 @@ public:
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
(void)b3CreateCompoundShape( groundId, &shapeDef, m_compound );
(void)b3CreateBakedCompoundShape( groundId, &shapeDef, m_compound );
delete[] hulls;
hulls = nullptr;
@ -420,7 +420,7 @@ public:
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
(void)b3CreateCompoundShape( groundId, &shapeDef, m_compound );
(void)b3CreateBakedCompoundShape( groundId, &shapeDef, m_compound );
}
#if 0
@ -650,7 +650,7 @@ public:
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
(void)b3CreateCompoundShape( groundId, &shapeDef, m_compound );
(void)b3CreateBakedCompoundShape( groundId, &shapeDef, m_compound );
delete[] capsules;
capsules = nullptr;

View file

@ -1071,7 +1071,7 @@ static void b3RecDispatch_CreateCompoundShape( const b3RecArgs_CreateCompoundSha
b3BodyId bodyId = b3RecMakeBodyId( rdr, a->body );
// b3CreateCompoundShape takes a non-const def pointer; cast away const for the scratch def
b3ShapeDef shapeDef = a->def;
b3ShapeId gotId = b3CreateCompoundShape( bodyId, &shapeDef, compound );
b3ShapeId gotId = b3CreateBakedCompoundShape( bodyId, &shapeDef, compound );
b3RecCheckShapeId( rdr, gotId, recId );
}

View file

@ -424,7 +424,7 @@ b3ShapeId b3CreateHeightFieldShape( b3BodyId bodyId, const b3ShapeDef* def, cons
return shapeId;
}
b3ShapeId b3CreateCompoundShape( b3BodyId bodyId, b3ShapeDef* def, const b3CompoundData* compound )
b3ShapeId b3CreateBakedCompoundShape( b3BodyId bodyId, b3ShapeDef* def, const b3CompoundData* compound )
{
b3ShapeId shapeId = b3CreateShape( bodyId, def, compound, b3_compoundShape, b3Transform_identity, b3Vec3_one, false );
if ( shapeId.index1 != 0 )

View file

@ -1144,7 +1144,7 @@ static int AllOps( void )
b3CompoundData* compound = b3CreateCompound( &compoundDef );
ENSURE( compound != NULL );
b3ShapeDef compoundShapeDef = b3DefaultShapeDef();
b3CreateCompoundShape( compoundBodyId, &compoundShapeDef, compound );
b3CreateBakedCompoundShape( compoundBodyId, &compoundShapeDef, compound );
// Throwaway shape to exercise DestroyShape
b3Sphere tmpSphere = { { 0.0f, 0.0f, 0.0f }, 0.1f };

View file

@ -570,7 +570,7 @@ static int TestCompoundHitEvents( void )
bodyDef.type = b3_staticBody;
b3BodyId compoundBodyId = b3CreateBody( worldId, &bodyDef );
b3ShapeDef compoundShapeDef = b3DefaultShapeDef();
b3CreateCompoundShape( compoundBodyId, &compoundShapeDef, compound );
b3CreateBakedCompoundShape( compoundBodyId, &compoundShapeDef, compound );
// Sphere driven straight down onto the chosen child
bodyDef = b3DefaultBodyDef();