Repository navigation
ci: add CodSpeed performance benchmarks - #485
Open
codspeed[bot] wants to merge 2 commits into
Open
codspeed[bot] wants to merge 2 commits into
codspeed[bot] wants to merge 2 commits into
Conversation
Switch the Criterion dev-dependency to codspeed-criterion-compat, add response mapping benchmarks, a CodSpeed workflow and the README badge.
Author
Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch.
|
RAprogramm
marked this pull request as ready for review
November 5, 2026 06:13
This branch has not been deployed
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
This PR wires the existing Criterion benchmarks into CodSpeed so performance is tracked on every push to
mainand on every pull request.Changes
Cargo.toml/Cargo.lock: thecriteriondev-dependency now points tocodspeed-criterion-compat(renamed tocriterion). The benchmark source code does not need to change.cargo benchstill behaves as before (the compat crate falls back to regular Criterion measurements), so the existingBenchmarksjob inci.ymland its--save-baselineartifact keep working.benches/response_mapping.rs(new): covers transport-facing hot paths that the existing suites did not measure:AppErrorconstruction, plain and with metadata (fields, code, retry-after,WWW-Authenticate)AppCode::from_strfor built-in and custom codesErrorResponse::fromfor both&AppErrorand an ownedAppErrorErrorResponseandProblemJsonDisplayrendering ofAppError.github/workflows/codspeed.yml(new): builds the benchmarks withcargo-codspeedand runs them throughCodSpeedHQ/action@v5in simulation mode onubuntu-latest. It authenticates with OIDC (id-token: write), so no token secret is needed. It uses the same toolchain and cache actions asci.yml.README.template.mdandREADME.md.Together with the existing
comparisonanderror_pathssuites, CodSpeed tracks 28 benchmarks. A local simulation run completed without errors.Why simulation mode
CPU simulation measures instruction counts and cache behaviour instead of wall-clock time. Results are deterministic, so standard GitHub runners work fine and the noise is low enough to catch small regressions in these microsecond-scale error paths.
Next steps
maingets its first baseline. After that, every PR gets a performance report comment.CodSpeedworkflow manually (workflow_dispatch) to backfill history.benches/*.rsfiles. They are picked up automatically, but each new bench file needs a[[bench]]entry withharness = false.Comment
@codspeedbot <request>(for example, "add benchmarks for the axum IntoResponse path") and I'll do it.