Skip to content

Add -substeps: trade solver accuracy for CPU headroom on slower hardware - #40

Merged
crgimenes merged 1 commit into
crgimenes:trunkfrom
johncohn:feature/substeps-flag
Aug 3, 2026
Merged

Add -substeps: trade solver accuracy for CPU headroom on slower hardware#40
crgimenes merged 1 commit into
crgimenes:trunkfrom
johncohn:feature/substeps-flag

Conversation

@johncohn

@johncohn johncohn commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Closes #39.

Converts both build-tagged `substeps` consts to vars and adds `-substeps` to override either one at runtime, no rebuild needed.

Validated on-device: dropping from 3 to 2 on a Pi 5 cut solver time from ~15ms to ~10-11ms per tick (measured with `-debug`) — the difference between visibly catching up to the tick rate and visibly falling behind it, at the cost of the accuracy that one fewer LBM step per displayed frame represents.

Tested: `go test ./...` passes, plus a native and WASM build (this touches both build-tagged files).

substeps (native: 3, wasm: 1) was a const tuned for each build target's own
measured per-step cost, with no way to adjust it for hardware in between --
a Raspberry Pi 5, for instance, running the exhibit's actual 24-mic acoustic
localization display alongside kutta, benefits from trading a substep or
two for headroom.

Converts both build-tagged consts to vars and adds -substeps to override
either one at runtime, no rebuild needed. Validated on-device: dropping
from 3 to 2 on a Pi 5 cut solver time from ~15ms to ~10-11ms per tick
(measured with -debug), the difference between visibly catching up to the
tick rate and visibly falling behind it, at the cost of the accuracy that
one fewer LBM step per displayed frame represents.

@crgimenes crgimenes left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated on the hardware that motivated it, and the flag composes with -tps/-warp correctly. Merging, thanks.

@crgimenes
crgimenes merged commit 39042d2 into crgimenes:trunk Aug 3, 2026
6 checks passed
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.

Add a way to trade solver accuracy for CPU headroom on weaker hardware

2 participants