Skip to content

Support search without a division or spills; a tiny bench scene - #238

Merged
nicolas-maman merged 2 commits into
mainfrom
tiny-scene
Nov 25, 2026
Merged

nicolas-maman merged 2 commits into
mainfrom
tiny-scene

Conversation

@nicolas-maman

Copy link
Copy Markdown
Collaborator

Progress at a glance

  • Hull support search starts from -FLT_MAX, as Box3D does, instead of a run-time -infinity division
  • Its reduction reads lanes at fixed indices and converts the winning index once
  • The manifold's edge search starts from FLT_MAX, as Box3D's does
  • New tiny bench scene on both sides (ground plus 8 resting spheres, never sleeping)
  • Both suites print each graph colour's constraint count
  • Full local suite on Aether 0.944.0: green, golden trace bit for bit, no warnings

Why

The hull support search was 2.4 times slower per call than Box3D's in trees25 (385 samples against 161), and the compiled code showed three costs:

  • It started from -infinity, and 1.0 / 0.0 in the source is a divss on every call.
  • The reduction read lanes with a run-time index, so each read spilled the vector and reloaded it.
  • Every lane's index went through Aether's checked float-to-int conversion, which widens to double, checks NaN and range, and branches.

Box3D starts from -FLT_MAX and indexes plain arrays.

Numbers

Pinned to one core, best of four, ms per step:

Scene main this PR Box3D
trees25 1.483 1.446 1.316
convex pile 10.25 10.13 9.49
junkyard 22.33 21.91 22.01

Bench additions

  • tiny measures a step's fixed cost: ours 3.77 µs against Box3D's 3.52, pinned.
  • The colour counts show that both engines colour every scene identically, which rules colouring out as a cause of the large world gap.

tiny is a ground box and eight resting spheres that never sleep, so a
step's fixed cost is most of what is timed (ours 3.77 us, Box3D 3.52,
pinned). Both suites print each colour's constraint count after a scene;
the two colour every scene the same.
find_hull_support_vertex started from -infinity, which is a division on
every call (1.0 / 0.0 written in the source), and its reduction read the
lanes at a loop's index (a spill and a reload each) and converted every
lane's index through the checked float-to-int path. Now it starts from
-FLT_MAX as the reference does, reads the four lanes at fixed indices
and keeps the indices as floats until one conversion at the end. The
manifold's edge search starts from FLT_MAX as the reference's does.
Pinned: trees25 2.5% faster, the convex pile 1.1%, the junkyard 1.9%.
Bits unchanged.
@nicolas-maman
nicolas-maman merged commit f8d242f into main Nov 25, 2026
3 checks passed
@nicolas-maman
nicolas-maman deleted the tiny-scene branch November 25, 2026 01:16
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