Skip to content

Commit eb3b386

Browse files
authored
Add codespeed for continuous profiling (and sudoku) (#271)
* Add codespeed for continuous (and sudoku) While pubgrub's performance is critical for both uv and cargo, there currently no benchmarking happening in the repository. [Codspeed](https://codspeed.io) runs our benchmarks with instruction counting, reporting more numbers with less variance than wall time. We get feedback on every PR, can see trends over time and there are flamegraphs and flamegraph diffs in the web view. We've made good experiences with it in both ruff and uv. With codspeed installed, we can start adding real-world benchmarks for uv and cargo to the pubgrub repo, and then optimize those. * serde
1 parent 4099a2e commit eb3b386

File tree

4 files changed

+327
-18
lines changed

4 files changed

+327
-18
lines changed

.github/workflows/benchmarks.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Benchmarks (CodSpeed)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
benchmarks:
12+
name: Run benchmarks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup rust toolchain, cache and cargo-codspeed binary
17+
uses: moonrepo/setup-rust@v1
18+
with:
19+
channel: stable
20+
cache-target: release
21+
bins: cargo-codspeed
22+
23+
- name: Build the benchmark target(s)
24+
run: cargo codspeed build --features serde
25+
26+
- name: Run the benchmarks
27+
uses: CodSpeedHQ/action@v3
28+
with:
29+
run: cargo codspeed run

Cargo.lock

Lines changed: 116 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ thiserror = "1.0"
3232
version-ranges = { version = "0.1.0", path = "version-ranges" }
3333

3434
[dev-dependencies]
35-
criterion = "0.5"
35+
criterion = { version = "2.7.2", package = "codspeed-criterion-compat" }
3636
env_logger = "0.11.5"
3737
proptest = "1.5.0"
3838
ron = "=0.9.0-alpha.0"
@@ -46,3 +46,7 @@ serde = ["dep:serde", "version-ranges/serde"]
4646
name = "large_case"
4747
harness = false
4848
required-features = ["serde"]
49+
50+
[[bench]]
51+
name = "sudoku"
52+
harness = false

0 commit comments

Comments
 (0)