Skip to content

Joint grid at 1.05x Box3D: float joint inertias, the warm start skips a zero angular sum (#121) - #137

Merged
nicolas-maman merged 2 commits into
mainfrom
perf/joint-records
Oct 8, 2026
Merged

nicolas-maman merged 2 commits into
mainfrom
perf/joint-records

Conversation

@nicolas-maman

Copy link
Copy Markdown
Collaborator

The joint grid's solve and relax were already ahead of Box3D e77352c; the gap was the warm start and the prepare (#121). Two changes, neither of which moves a bit of any result (the golden determinism trace is unchanged):

  • JointSim keeps the bodies' world inertias in float, as the body sims hold them; the joint solvers widen them where they read them. They were floats widened at the prepare, so nothing rounds differently. The record goes from 912 bytes to 840.
  • The spherical joint's warm start adds its angular impulses (spring, motor, cone, twist limits) only when one of those parts is on. Each part zeroes its impulse when it goes off, so the skipped sum is exactly zero. A new check in tests/test_joint_solver.ae pins that invariant: every part turned off leaves no angular impulse, and the warm start of a plain point moves the body by the point's impulse alone.

Joint grid, pinned to one core, 8 runs each interleaved, ms per step:

min median
main 11.23 11.91
this PR 10.78 10.90
Box3D e77352c, AVX2 10.21 10.34

Stages: warm start 1.97-2.23 to 1.37-1.40 ms (Box3D 1.17-1.26), prepare 1.10-1.23 to 0.93-0.95 (0.51-0.58). The grid goes from 1.1x the reference to 1.05x.

Tried and dropped, written up in bench/RESULTS.md: the spherical joint's frames, impulses, axes and masses in float as the reference keeps them. The warm start only reached 1.5-1.6 ms, and the solve and relax lost 0.3 ms each to the narrowing and widening on their impulse-to-velocity chain. Computing the limit axes only for joints with a limit gained nothing, since GCC already sinks them. What remains is the double arithmetic over float records: each read widens and each store narrows, where the reference computes in float throughout.

Refs #121.

@nicolas-maman
nicolas-maman merged commit 004c7ff into main Oct 8, 2026
2 checks passed
@nicolas-maman
nicolas-maman deleted the perf/joint-records branch October 8, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant