Repository navigation
perf(vision): reuse exact LK template samples across iterations - #336
Merged
Merged
Conversation
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.
Sparse CPU LK repeatedly sampled the same previous-image template during each point/level solve. Lazily retain its exact center and gradient values in a call-local array for radii at most five and multiple configured iterations. Keep both-frame bounds checks every iteration, the accumulation/update order, fallback expressions, custom conversions and public APIs. The complete cache type is compile-time bounded to 4 KiB with no new heap allocation.
Validation: 96 vision tests before and after, 24 web tests, no-feature vision build, two Clippy checks and formatting pass. The complete parent module is frozen before implementation. All 126 independent native camera reports and 252 actual WASM reports/84 rejections match. All 92 JS, six asset and 86 browser controls pass with synthetic capture.
Two interleaved surveys retain every result: 17 of 36 paired medians are lower, 19 higher, with a worst observed ratio of 1.521. All 12 nonempty translated-image pairs are 66-75% shorter. Stationary/empty cases and compiler placement/inlining differences are explicit limitations; the frozen module is local to the driver and the candidate calls the library. Empty calls never enter the changed kernel. Existing independent camera timings were also inspected as an explicitly exploratory secondary check, with every condition retained separately. No physical-phone, GPU or end-to-end browser speed claim.
The fresh offline target stays under its 1 GiB cap with zero shared-cache growth, preserving all 5,038 earlier camera/renderer files and scientific/native evidence. No sensor, model, SDK, browser or toolchain acquisition. See docs/LK_TEMPLATE_REUSE.md and docs/receipts/2026-10-22_lk_template_reuse.json. Operational 80% gates remain open.