Skip to content

Add CodSpeed continuous performance measurement#1942

Draft
codspeed-hq[bot] wants to merge 1 commit into
mainfrom
codspeed/wizard-1783169836649
Draft

Add CodSpeed continuous performance measurement#1942
codspeed-hq[bot] wants to merge 1 commit into
mainfrom
codspeed/wizard-1783169836649

Conversation

@codspeed-hq

@codspeed-hq codspeed-hq Bot commented Jul 4, 2026

Copy link
Copy Markdown

Summary

This PR sets up CodSpeed for continuous performance measurement of River's Rust core (the stats module in rust_src, exposed to Python via PyO3).

River already ships a set of criterion benchmarks in benches/stats_bench.rs covering the streaming statistics primitives (mean, variance, EW mean/variance, kurtosis, skew, quantile, rolling quantile, rolling IQR). This change wires those benchmarks into CodSpeed so performance is tracked automatically on every pull request and on pushes to main.

Changes

  • Cargo.toml: Swapped the criterion dev-dependency for codspeed-criterion-compat (aliased as criterion, version 5.0.1). The compat layer is a drop-in replacement, so benches/stats_bench.rs is unchanged. Also declared the stats_bench bench target with harness = false so it is picked up by cargo codspeed.
  • Cargo.lock: Updated to reflect the new dependency.
  • .github/workflows/codspeed.yml: New workflow that builds and runs the benchmarks under CodSpeed. It uses OIDC authentication (no token secret required) and runs all three requested instruments via a matrix:
    • CPU Simulation (instrumentation) on ubuntu-latest — deterministic, low-variance CPU measurements with flamegraphs.
    • Memory (memory) on ubuntu-latest — heap allocation and peak-memory tracking.
    • Wall time (walltime) on codspeed-macro runners — real-world elapsed time on consistent bare-metal hardware.
  • README.md: Added the CodSpeed badge alongside the existing status badges.

Verification

The setup was validated locally with the CodSpeed CLI:

  • cargo codspeed build and codspeed run --mode instrumentation -- cargo codspeed run completed successfully and reported all 13 benchmarks.
  • cargo codspeed build -m memory and cargo codspeed build -m walltime both compile cleanly. Their runtime measurement could not be exercised in the local sandbox (memory needs an eBPF/BTF-capable kernel and walltime needs perf), but both run on CodSpeed's CI runners.

Next steps

  • Merge to start collecting a performance baseline on main.
  • Subsequent PRs will automatically get a performance report comparing against the base branch.
  • Consider extending coverage to other hot paths as more of River's core moves to Rust.

@codspeed-hq

codspeed-hq Bot commented Jul 4, 2026

Copy link
Copy Markdown
Author

Congrats! CodSpeed is installed 🎉

🆕 26 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Open in CodSpeed

@codspeed-hq codspeed-hq Bot marked this pull request as ready for review July 4, 2026 13:04
@AdilZouitine AdilZouitine marked this pull request as draft July 4, 2026 13:52
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