Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
847740e
feat(timeout): add benchmarking support with divan
mattsu2020 Dec 20, 2025
2bbf44e
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Dec 20, 2025
d8dedda
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Dec 20, 2025
10bd153
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Dec 22, 2025
e312149
refactor(timeout/benches): simplify unix-specific benchmark structure
mattsu2020 Dec 22, 2025
81d7354
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Dec 23, 2025
52cd47f
ci: add uu_timeout to benchmarks
mattsu2020 Dec 24, 2025
d032ed1
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Dec 26, 2025
98d6a10
Merge branch 'main' into timeout-bench-only-clean
sylvestre Dec 29, 2025
26240c2
refactor(bench): simplify timeout benchmark by removing child process…
mattsu2020 Dec 30, 2025
2459c4c
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Jan 14, 2026
8fe8bf8
refactor(bench): inline timeout benchmark logic
mattsu2020 Jan 14, 2026
b53bcb5
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Jan 15, 2026
4f9b2b7
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Jan 16, 2026
a6d14cc
chore(deps): update divan package version from 4.0.5 to 4.2.1
mattsu2020 Jan 16, 2026
effde91
chore(benches): comment out timeout_quick_exit benchmark
mattsu2020 Jan 16, 2026
5a0da40
Merge branch 'main' into timeout-bench-only-clean
mattsu2020 Jan 17, 2026
656c486
ci(benchmarks): add RUST_BACKTRACE env var for debugging
mattsu2020 Jan 18, 2026
03a63f7
fix(ci): update RUST_BACKTRACE to "full" in benchmarks workflow
mattsu2020 Jan 18, 2026
b948a14
ci(benchmarks): update Rust setup to use moonrepo/setup-rust with car…
mattsu2020 Jan 18, 2026
a60e79b
ci: update spell-checker ignore list in benchmarks workflow
mattsu2020 Jan 18, 2026
4cf18ad
perf: enable benchmark for timeout quick exit path
mattsu2020 Jan 18, 2026
b17989d
fix(ci): correct Rust version parameter in benchmarks workflow
mattsu2020 Jan 18, 2026
cfdb321
fix(ci): correct spacing in benchmarks workflow Rust channel
mattsu2020 Jan 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Benchmarks

# spell-checker:ignore codspeed dtolnay Swatinem sccache
# spell-checker:ignore codspeed dtolnay Swatinem sccache memtrack moonrepo

on:
pull_request:
Expand Down Expand Up @@ -43,6 +43,7 @@ jobs:
uu_shuf,
uu_sort,
uu_split,
uu_timeout,
uu_tsort,
uu_unexpand,
uu_uniq,
Expand All @@ -55,16 +56,15 @@ jobs:
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9

- name: Install cargo-codspeed
shell: bash
run: cargo install cargo-codspeed --locked
# Prefer CodSpeed's recommended setup to keep toolchain/binary versions aligned
# with the CodSpeed action (helps avoid memtrack/cargo-codspeed incompatibilities).
- name: Setup Rust (with cargo-codspeed)
uses: moonrepo/setup-rust@v1
with:
channel: 1.85.0
cache: true
cache-target: true
bins: cargo-codspeed

- name: Build benchmarks for ${{ matrix.package }} (${{ matrix.type }})
shell: bash
Expand All @@ -80,6 +80,7 @@ jobs:
uses: CodSpeedHQ/action@v4
env:
CODSPEED_LOG: debug
RUST_BACKTRACE: full
with:
mode: ${{ matrix.type == 'memory' && 'memory' || 'simulation' }}
run: |
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ compare = "0.1.0"
crossterm = "0.29.0"
ctor = "0.6.0"
ctrlc = { version = "3.4.7", features = ["termination"] }
divan = { package = "codspeed-divan-compat", version = "4.0.5" }
divan = { package = "codspeed-divan-compat", version = "4.2.1" }
dns-lookup = { version = "3.0.0" }
exacl = "0.12.0"
file_diff = "1.0.0"
Expand Down
8 changes: 8 additions & 0 deletions src/uu/timeout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ fluent = { workspace = true }
[[bin]]
name = "timeout"
path = "src/main.rs"

[dev-dependencies]
divan = { workspace = true }
uucore = { workspace = true, features = ["benchmark"] }

[[bench]]
name = "timeout_bench"
harness = false
34 changes: 34 additions & 0 deletions src/uu/timeout/benches/timeout_bench.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

#[cfg(unix)]
use divan::{Bencher, black_box};
#[cfg(unix)]
use uu_timeout::uumain;
#[cfg(unix)]
use uucore::benchmark::run_util_function;

/// Benchmark the fast path where the command exits immediately.
#[cfg(unix)]
#[divan::bench]
fn timeout_quick_exit(bencher: Bencher) {
bencher.bench(|| {
black_box(run_util_function(uumain, &["0.02", "true"]));
});
}

/// Benchmark a command that runs longer than the threshold and receives the default signal.
#[cfg(unix)]
#[divan::bench]
fn timeout_enforced(bencher: Bencher) {
bencher.bench(|| {
black_box(run_util_function(uumain, &["0.02", "sleep", "0.2"]));
});
}

fn main() {
#[cfg(unix)]
divan::main();
}
Loading