Optimize Broad-Phase (#159)

Broad-phase optimization ported from Box2D.
This commit is contained in:
Erin Catto 2026-09-16 22:28:39 -07:00 • committed by GitHub
commit f555ee4208
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 3802 additions and 1830 deletions

View file

@ -78,6 +78,8 @@ void b3ParallelFor( b3World* world, b3ParallelForCallback* callback, int itemCou
// block size grows once items exceed maxBlockCount * minRange
// so the block count stays bounded and per-block sync overhead stays low.
// Benchmarking shows 32 is optimal for the convex pile benchmark and others.
// This is a lot different than Box2D because the 3D narrow phase cost
// varies a lot.
int blocksPerWorker = 32;
int maxBlockCount = blocksPerWorker * workerCount;