Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:

- run: cargo codspeed build -p codspeed-divan-compat
- run: cargo codspeed build -p codspeed-divan-compat-examples
- run: cargo codspeed build -p codspeed-criterion-compat

- name: Run the benchmarks
uses: CodSpeedHQ/action@main
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

[submodule "crates/divan_compat/examples/src/the_algorithms/Rust"]
path = crates/divan_compat/examples/src/the_algorithms/Rust
url = git@github.com:TheAlgorithms/Rust.git
url = https://github.com/TheAlgorithms/Rust.git
106 changes: 69 additions & 37 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
members = [
"crates/codspeed",
"crates/bencher_compat",
"crates/criterion_compat",
"crates/cargo-codspeed",

"crates/criterion_compat",
"crates/criterion_compat/criterion_fork",

"crates/divan_compat",
"crates/divan_compat/macros",
"crates/divan_compat/divan_fork",
Expand All @@ -16,3 +18,4 @@ resolver = "2"
itertools = "0.14.0"
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.138"
tempfile = "3.7.0"
9 changes: 9 additions & 0 deletions crates/cargo-codspeed/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ fn aggregate_raw_walltime_data(workspace_root: &Path) -> Result<()> {
return Ok(());
}

for bench in &walltime_benchmarks {
if bench.is_invalid() {
eprintln!(
"Warning: Benchmark {} was possibly optimized away",
bench.name()
);
}
}

let results_folder = std::env::var("CODSPEED_PROFILE_FOLDER")
.map(PathBuf::from)
.unwrap_or_else(|_| workspace_root.join("target/codspeed/profiles"))
Expand Down
10 changes: 10 additions & 0 deletions crates/cargo-codspeed/src/walltime_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ pub struct WalltimeBenchmark {
stats: BenchmarkStats,
}

impl WalltimeBenchmark {
pub(crate) fn is_invalid(&self) -> bool {
self.stats.min_ns < f64::EPSILON
}

pub(crate) fn name(&self) -> &str {
&self.metadata.name
}
}

impl From<RawWallTimeData> for WalltimeBenchmark {
fn from(value: RawWallTimeData) -> Self {
let times_ns: Vec<f64> = value.times_ns.iter().map(|&t| t as f64).collect();
Expand Down
2 changes: 1 addition & 1 deletion crates/codspeed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ name = "native"
harness = false

[dev-dependencies]
tempfile = "3.7.0"
tempfile = { workspace = true }
2 changes: 1 addition & 1 deletion crates/criterion_compat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ categories = [
]
keywords = ["codspeed", "benchmark", "criterion"]
[dependencies]
criterion = { version = "0.5.1", default-features = false }
criterion = { package = "codspeed-criterion-compat-walltime", path = "./criterion_fork", version = "0.5.1", default-features = false }
codspeed = { path = "../codspeed", version = "=2.8.1" }
colored = "2.1.0"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod compare_functions;
pub mod custom_measurement;
pub mod external_process;
// pub mod external_process;
pub mod iter_with_large_drop;
pub mod iter_with_large_setup;
pub mod iter_with_setup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod criterion_integration;

criterion_main! {
criterion_integration::compare_functions::fibonaccis,
criterion_integration::external_process::benches,
// criterion_integration::external_process::benches, FIXME: Currently doesn't work
criterion_integration::iter_with_large_drop::benches,
criterion_integration::iter_with_large_setup::benches,
criterion_integration::iter_with_setup::benches,
Expand Down
8 changes: 8 additions & 0 deletions crates/criterion_compat/criterion_fork/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
14 changes: 14 additions & 0 deletions crates/criterion_compat/criterion_fork/.github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
113 changes: 113 additions & 0 deletions crates/criterion_compat/criterion_fork/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
on:
push:
branches:
- master
pull_request:
branches:
- master
- version-0.4

name: tests
env:
CARGO_TERM_COLOR: always

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.64.0 # MSRV
- nightly

steps:
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
name: Setup rust toolchain
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2
name: Load dependencies from cache

- uses: actions-rs/cargo@v1
name: Build with stable features
with:
command: build
args: --features stable

- uses: actions-rs/cargo@v1
if: ${{ matrix.rust == 'nightly' }}
name: Build with unstable features
with:
command: build
args: --all-features

- uses: actions-rs/cargo@v1
name: Build with minimal features
with:
command: build
args: --no-default-features

- uses: actions-rs/cargo@v1
name: Test with stable features
with:
command: test
args: --features stable

- uses: actions-rs/cargo@v1
name: Test with minimal features
with:
command: test
args: --no-default-features

- uses: actions-rs/cargo@v1
name: Check for non-standard formatting
if: ${{ matrix.rust == 'stable' }}
with:
command: fmt
args: --all -- --check

- uses: actions-rs/cargo@v1
name: Check for clippy hints
if: ${{ matrix.rust == 'stable' }}
with:
command: clippy
args: -- -D warnings

- name: Test run targeting WASI
run: |
curl https://wasmtime.dev/install.sh -sSf | bash
source ~/.bashrc
export PATH=$HOME/.wasmtime/bin/:$PATH
cargo install cargo-wasi
cargo wasi bench --no-default-features -- --test

nextest-compat:
name: Check compatibility with nextest
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable

steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v1

- uses: taiki-e/install-action@nextest

- run: ci/nextest-compat.sh
Loading