Skip to content

Commit f880e03

Browse files
authored
Use cargo codspeed for running Rust benchmarks (#2688)
- Remove criterion from non-benchmarking crates - Configure cargo codspeed - Update cargo lock
1 parent 01c905c commit f880e03

File tree

13 files changed

+18
-20
lines changed

13 files changed

+18
-20
lines changed

.github/actions/common-setup/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ runs:
8080
with:
8181
tool: nextest
8282

83+
- name: Install cargo-codspeed
84+
# https://github.com/taiki-e/install-action # v2.50.10
85+
uses: taiki-e/install-action@83254c543806f3224380bf1001d6fac8feaf2d0b
86+
with:
87+
tool: cargo-codspeed
88+
8389
# > --------------------------------------------------
8490
# > sccache
8591
- name: Set sccache env vars (common)

.github/workflows/performance.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,15 @@ jobs:
7878
with:
7979
token: ${{ secrets.CODSPEED_TOKEN }}
8080
run: uv run --no-sync pytest tests/performance_tests --benchmark-disable-gc --codspeed
81+
82+
- name: Build the benchmark target(s)
83+
run: |
84+
# Replace criterion with codspeed-criterion-compat in Cargo.toml files
85+
find . -name "Cargo.toml" -exec sed -i 's/criterion = "0.5.1"/criterion = { version = "2.10.1", package = "codspeed-criterion-compat" }/g' {} +
86+
cargo codspeed build
87+
88+
- name: Run the benchmarks
89+
uses: CodSpeedHQ/action@v3
90+
with:
91+
token: ${{ secrets.CODSPEED_TOKEN }}
92+
run: cargo codspeed run

Cargo.lock

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

crates/adapters/coinbase_intx/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ uuid = { workspace = true }
7575

7676
[dev-dependencies]
7777
nautilus-testkit = { workspace = true }
78-
criterion = { workspace = true }
7978
rstest = { workspace = true }
8079
tracing-test = { workspace = true }
8180

crates/adapters/databento/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ time = "0.3.41"
6868

6969
[dev-dependencies]
7070
nautilus-testkit = { workspace = true }
71-
criterion = { workspace = true }
7271
rstest = { workspace = true }
7372
tracing-test = { workspace = true }
7473

crates/adapters/demo/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ tokio-stream = "0.1.17"
6767

6868
[dev-dependencies]
6969
nautilus-testkit = { workspace = true }
70-
criterion = { workspace = true }
7170
rstest = { workspace = true }
7271
tracing-test = { workspace = true }
7372

crates/adapters/tardis/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ urlencoding = "2.1.3"
7171

7272
[dev-dependencies]
7373
nautilus-testkit = { workspace = true }
74-
criterion = { workspace = true }
7574
rstest = { workspace = true }
7675
tracing-test = { workspace = true }
7776

crates/analysis/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,4 @@ pyo3 = { workspace = true, optional = true }
4747
rust_decimal = { workspace = true }
4848

4949
[dev-dependencies]
50-
criterion = { workspace = true }
5150
rstest = { workspace = true }

crates/data/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,4 @@ pyo3 = { workspace = true, optional = true }
6262
ustr = { workspace = true }
6363

6464
[dev-dependencies]
65-
criterion = { workspace = true }
6665
rstest = { workspace = true }

crates/portfolio/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,4 @@ thiserror = { workspace = true }
5252
ustr = { workspace = true }
5353

5454
[dev-dependencies]
55-
criterion = { workspace = true }
5655
rstest = { workspace = true }

0 commit comments

Comments
 (0)