Repository navigation
Prune contact pairs that can't touch; hardware sqrt on wasm - #23
Merged
Merged
Conversation
Each bud contact candidate keeps its build-time distance and skips the closest-point test while that distance, less how far its point and triangle have moved, can't reach dmin. The candidate search bins nodes into a flat grid instead of a hash map. math::sqrt uses the correctly rounded hardware instruction, which libm only used natively. Output is byte-identical: golden digests pass natively and under wasm. Seed 11 bud: 15.1 s to 8.5 s natively, 28.8 s to 11.8 s under wasm. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdZbN9NhQWL37K9Pfy1cE
ALopezMoreno
pushed a commit
that referenced
this pull request
Oct 16, 2026
Each pair keeps a lower bound on its distance at the anchors; energy skips it while the bound minus the nodes' motion since still clears the contact distance. Skin goes from 0.5 to 1.0 cap. Byte-identical output; seed 11 goes from 39 s to 35 s. Recipe from the Performance thread (#23). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015RyRGSRwEuGkCyT3Szodbz
…-g4jisn # Conflicts: # core/PERFORMANCE.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Andres · project thread
Before: growing seed 11's bud took 15.1 s natively and 28.8 s under wasm. About two thirds of each energy evaluation went on contact pairs that weren't touching (about 1% of roughly 250k candidates were in contact).
After: the same bud takes 8.5 s natively and 11.8 s under wasm, and the output is byte-identical. Golden digests pass natively and under wasm (checked locally with the CI's sharded wasm run).
How:
dmin, the pair can't be in contact, socontacts()skips the closest-point test. It drops only pairs the test would discard, so the sums are unchanged.candidates()bins nodes into a flat grid by counting sort, and scans each row's cells as one run, instead of using a hash map. The list is still sorted, so the grid affects speed only.math::sqrtusesf64::sqrt. IEEE 754 requires sqrt to be correctly rounded, so the bits are the same everywhere.libm::sqrtalready used the instruction natively but fell back to a software routine on wasm.determinism.tex,packing.texandcore/PERFORMANCE.mdare updated.The opening's contact code (PR #14) can use the same skip. That is left to the flowering thread.
🤖 Generated with Claude Code
https://claude.ai/code/session_015vdZbN9NhQWL37K9Pfy1cE
Generated by Claude Code