Skip to content

Commit 2e4f91a

Browse files
committed
evaluate codspeed for perfs
1 parent f4b7638 commit 2e4f91a

File tree

5 files changed

+352
-5
lines changed

5 files changed

+352
-5
lines changed

.github/workflows/codspeed.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CodSpeed Benchmarks
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
benchmarks:
14+
name: Run benchmarks
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
with:
19+
persist-credentials: false
20+
21+
- name: Install system dependencies
22+
shell: bash
23+
run: |
24+
sudo apt-get -y update
25+
sudo apt-get -y install libselinux1-dev
26+
27+
- uses: dtolnay/rust-toolchain@stable
28+
29+
- uses: Swatinem/rust-cache@v2
30+
31+
- name: Run sccache-cache
32+
uses: mozilla-actions/[email protected]
33+
34+
- name: Install cargo-codspeed
35+
shell: bash
36+
run: cargo install cargo-codspeed
37+
38+
- name: Build release binary
39+
shell: bash
40+
run: cargo build --release
41+
42+
- name: Run benchmarks
43+
uses: CodSpeedHQ/action@v4
44+
with:
45+
mode: instrumentation
46+
run: |
47+
# Find all utilities with benchmarks and run them
48+
find src/uu/*/benches/ -name "*.rs" 2>/dev/null | while read bench_file; do
49+
crate_dir=$(dirname $(dirname "$bench_file"))
50+
echo "Running benchmarks in $crate_dir"
51+
(cd "$crate_dir" && cargo codspeed run)
52+
done
53+
token: ${{ secrets.CODSPEED_TOKEN }}

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ compare = "0.1.0"
316316
crossterm = "0.29.0"
317317
ctor = "0.5.0"
318318
ctrlc = { version = "3.4.7", features = ["termination"] }
319+
divan = "0.1"
319320
dns-lookup = { version = "3.0.0" }
320321
exacl = "0.12.0"
321322
file_diff = "1.0.0"

src/uu/wc/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ fluent = { workspace = true }
2929
nix = { workspace = true }
3030
libc = { workspace = true }
3131

32+
[dev-dependencies]
33+
divan = { workspace = true }
34+
tempfile = { workspace = true }
35+
3236
[[bin]]
3337
name = "wc"
3438
path = "src/main.rs"
39+
40+
[[bench]]
41+
name = "wc_bench"
42+
harness = false

0 commit comments

Comments
 (0)