Skip to content

test(benchmarks): isolated microbenchmarks for core hot-path kernels#213

Open
HanSur94 wants to merge 1 commit into
mainfrom
claude/inspiring-brahmagupta-27ba48
Open

test(benchmarks): isolated microbenchmarks for core hot-path kernels#213
HanSur94 wants to merge 1 commit into
mainfrom
claude/inspiring-brahmagupta-27ba48

Conversation

@HanSur94

Copy link
Copy Markdown
Owner

What

Adds five focused, deterministic benchmarks that grow coverage over FastSense's performance-critical surface. Each isolates one hot-path kernel as pure computation (no figure / no rendering) and guards it with a machine-independent scaling gate — so a regression trips the gate regardless of host speed.

Benchmark Kernel / path Gate
bench_downsample_kernels.m MinMax + LTTB downsampling (minmax_core_mex / lttb_core_mex) log-log size exponent ≤ 1.3
bench_binary_search.m range-window lookup (binary_search_mex) per-query exponent ≤ 0.6 (catches O(log N)→O(N))
bench_violation_cull.m fused threshold-marker detect+cull (violation_cull_mex), constant + step-function size exponent ≤ 1.3
bench_datastore_range.m disk range query (FastSenseDataStore.getRange) fixed-window query time ~constant vs dataset size (catches full-scan)
bench_delimited_parse.m CSV ingestion (delimited_parse_mex) row exponent ≤ 1.3

Why

  • LTTB downsampling and the CSV-ingestion kernel had zero benchmark coverage; the others were only exercised indirectly inside render-heavy sweeps.
  • The gates are relative (scaling exponents), so they're stable across machines and CI — they catch algorithmic regressions (e.g. an indexed read degrading to a full scan, or super-linear parse creep), not absolute-time noise.

Notes

  • Follows the existing bench_*.m house style (path/install() header, size sweep, warmup, median-of-runs, printed table + assert gate).
  • Private wrappers are reached by cd-ing into the owning private/ folder — works in both MATLAB and Octave, unlike addpath of a private dir (which MATLAB rejects).
  • All five verified to run clean and PASS in MATLAB R2025b with MEX active.
  • benchmarks/.reports/coverage.md documents the ranked surface, what each run added, and the remaining gaps (e.g. EventStore persistence, LiveEventPipeline tick).
  • No library / production code changed — new files only. /bench-guard will baseline these on its next run.

🤖 Generated with Claude Code

Grows benchmark coverage over the performance-critical surface with five
focused, deterministic bench_*.m files, each isolating one hot-path kernel
as pure computation (no figure/render) and guarding it with a
machine-independent scaling gate:

  - bench_downsample_kernels.m  MinMax + LTTB downsampling (minmax_core_mex /
    lttb_core_mex). LTTB had zero coverage anywhere before this.
  - bench_binary_search.m       range-window lookup (binary_search_mex);
    log-scaling gate catches an O(log N) -> O(N) regression.
  - bench_violation_cull.m      fused threshold-marker detect+cull
    (violation_cull_mex), constant + step-function branches.
  - bench_datastore_range.m     disk-backed range query
    (FastSenseDataStore.getRange); gate asserts fixed-window query time stays
    ~constant as the dataset grows (catches a full-scan regression).
  - bench_delimited_parse.m     CSV ingestion (delimited_parse_mex);
    row-scaling gate. Tag-pipeline ingestion was previously unbenchmarked.

Each follows the existing bench_*.m house style and reaches private wrappers
by cd-ing into the owning private/ folder (works in both MATLAB and Octave,
unlike addpath of a private dir). benchmarks/.reports/coverage.md records the
ranked surface, what each run added, and the remaining gaps so coverage keeps
expanding toward what matters.

No library/production code changed; new files only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant