test(bench): add six performance benchmarks for core hot paths#215
Open
HanSur94 wants to merge 1 commit into
Open
test(bench): add six performance benchmarks for core hot paths#215HanSur94 wants to merge 1 commit into
HanSur94 wants to merge 1 commit into
Conversation
Grows benchmark coverage over the FastSense performance surface (via
/bench-evolve). All additive — new benchmark scripts only, no library or
production code changed. Each is deterministic and labels the active
MEX-vs-fallback path; verified in MATLAB R2025b (and Octave where the
feature supports it).
Kernel microbenchmarks (every MEX kernel wired into production):
- bench_downsample_kernels.m — LTTB + MinMax downsampling throughput
- bench_violation_cull.m — fused threshold detect + pixel cull (const & step)
- bench_binary_search.m — O(log N) viewport-clip / bucket-boundary latency
Composite-path benchmarks:
- bench_fastsense_multiline.m — live-update refresh vs line count (one axes)
- bench_detached_mirror_refresh.m — refresh overhead of detached live mirrors
(the project's headline constraint)
- bench_derived_resolve_chain.m — DerivedTag full-chain recompute vs depth
benchmarks/.reports/coverage.md tracks what is covered, what remains, and two
findings surfaced while writing these (both reported, not fixed here, per the
additive-only remit): three MEX kernels (compute_violations_mex,
to_step_function_mex, resolve_disk_mex) ship + parity-tested but have no
production call site; and DashboardWidgetRegistry.fromStruct uses an
Octave-incompatible dotted feval that breaks serialized-dashboard load and
widget detach under Octave.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Grows benchmark coverage across the FastSense performance surface, added incrementally via
/bench-evolve(one focused benchmark per iteration). Additive only — new benchmark scripts underbenchmarks/, no library or production code changed. Each benchmark is deterministic, labels the active MEX-vs-fallback path, and was verified in MATLAB R2025b (and Octave where the feature supports it).Kernel microbenchmarks — every MEX kernel wired into production
bench_downsample_kernels.m— LTTB + MinMax downsampling throughput (the coreresolve→downsample→renderkernels; previously LTTB was never timed). MEX: ~344 Mpts/s LTTB, ~1100 Mpts/s MinMax at 20M; O(N) confirmed.bench_violation_cull.m— fused threshold detect + pixel cull, exercising both the constant and time-varying (ZOH) threshold branches.bench_binary_search.m— per-call latency of the O(log N) viewport-clip / bucket-boundary search (the most ubiquitous hot-path call); ~1 µs/call, log-like scaling.Composite-path benchmarks
bench_fastsense_multiline.m— live-update refresh rate vs line count on one axes (564→39 Hz over 1→64 lines; sublinear per-line cost).bench_detached_mirror_refresh.m— refresh overhead of detached live mirrors, i.e. the project's headline constraint ("detached live-mirrored widgets must not degrade refresh rate"). Finds mirrors add real, increasing overhead (+35%→~+200% over 1→4 mirrors). MATLAB-only (Octave-skipped — see findings).bench_derived_resolve_chain.m— DerivedTag full-chain recompute cost vs dependency depth (cold ~linear in depth; warm cache flat ~0.02 ms, proving the lazy-memo).Coverage note
benchmarks/.reports/coverage.mdtracks what's covered, what remains, and the methodology lessons baked into the noisier composite benches (warmup, amortized vs per-tick median for bimodaldrawnow('limitrate')timing, min-over-reps for GC-bursty recompute).Findings surfaced (reported, not fixed here — additive-only remit)
compute_violations_mex,to_step_function_mex,resolve_disk_mexship with parity tests but have no production.mcall site. Either dead code or missing wiring.DashboardWidgetRegistry.fromStruct(libs/Dashboard/DashboardWidgetRegistry.m:92) usesfeval([className '.fromStruct'], s), which Octave can't resolve. This breaks serialized dashboard load and widget detach under Octave (a "fully supported" runtime). One-linestr2funcfix candidate noted in the coverage file.Test plan
bench_downsample_kernels,bench_violation_cull,bench_binary_search,bench_fastsense_multiline,bench_derived_resolve_chainrun under Octave 11;bench_detached_mirror_refreshcleanly skips on Octave (guarded — the detach feature is currently MATLAB-only per finding Add datetime X-axis support #2)./bench-guardand/perf-watch; no production code touched, so no regression risk to the library.🤖 Generated with Claude Code