perf(kpm): add dedicated kpm_bench.rs Criterion benchmark (#225)#229
Merged
Conversation
Times a single KpmHandle::kpm_matching query (the per-frame NFT detection path) with the pure-Rust RustFreakMatcher backend against the pinball reference marker on pinball-demo.jpg. marker_bench only covered barcode detection, so this is the first perf-regression signal for the FreakMatcher pipeline (deferred from #142). Reuses the existing examples/Data fixtures (pinball.fset3 + pinball-demo.jpg + camera_para.dat); ref-data load and handle build are done once outside the measured loop. sample_size=10 + 15s measurement keeps it runnable. Baseline: ~0.30 s median for the pure-Rust query on pinball-demo (2000x1500, release). The within-20% comparison vs the C++ CppFreakMatcher is available by building with --features ffi-backend and swapping the backend. Registered as a harness=false [[bench]]; BENCHMARKS.md updated. Refs #225 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
#225) BENCHMARKS.md still asserted "there is no dedicated benchmark exercising the KPM / FreakMatcher path" and framed the #142 within-20% target as deferred — both contradicted by kpm_bench.rs landing in this PR. - Rewrite the KPM/NFT section: the bench now exists; document what it measures, the fixtures, the criterion config, the run command, and the ~0.30 s pure-Rust baseline on pinball-demo (2000x1500). - Keep the functional parity evidence as supporting context and reframe the C++ comparison as a manual opt-in run (--features ffi-backend) rather than a deferred/missing check. - Add a bench inventory table to "Reproducing Benchmarks" (previously only simd_bench was mentioned). - Refresh the Last Updated stamp. Refs #225 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Closes #225. Adds the KPM-specific Criterion benchmark deferred from #142.
What
crates/core/benches/kpm_bench.rstimes a singleKpmHandle::kpm_matchingquery — the per-frame NFT detection path — with the pure-RustRustFreakMatcherbackend, against thepinballreference marker onpinball-demo.jpg.marker_benchonly covered barcode/template detection, so this is the first perf-regression signal for the FreakMatcher pipeline.examples/Datafixtures (pinball.fset3+pinball-demo.jpg+camera_para.dat) — same assets assimple_nftand the KPM regression tests.kpm_matchingis timed.sample_size=10+ 15 s measurement keeps it runnable in CI without dominating the suite.harness = false[[bench]];BENCHMARKS.mdupdated.Baseline
Pure-Rust query on
pinball-demo.jpg(2000×1500, release): ~0.30 s median (locally measured). The within-~20% comparison vs the C++CppFreakMatcher(the #142 goal) is available by building--features ffi-backendand swapping the backend — numbers are hardware-dependent, so this is a cross-validation reference, not a hard CI gate.Verified
cargo bench --bench kpm_benchruns and produces a stable measurementcargo fmt --checkclean; strictclippy --bench kpm_bench --all-features -D warningscleanPart of the Stabilization & DX milestone.
🤖 Generated with Claude Code