-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rust edition 2021 +
cargo fmt
+ cargo upgrade
+ taplo format
- Loading branch information
Showing
60 changed files
with
1,725 additions
and
2,703 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
branches: | ||
- master | ||
- version-0.4 | ||
- main | ||
|
||
name: tests | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ default = [] | |
name = "bencher_example" | ||
harness = false | ||
|
||
[workspace] | ||
[workspace] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
#[macro_use] | ||
extern crate criterion_bencher_compat; | ||
|
||
use criterion_bencher_compat::Bencher; | ||
|
||
fn a(bench: &mut Bencher) { | ||
bench.iter(|| { | ||
(0..1000).fold(0, |x, y| x + y) | ||
}) | ||
} | ||
|
||
fn b(bench: &mut Bencher) { | ||
const N: usize = 1024; | ||
bench.iter(|| { | ||
vec![0u8; N] | ||
}); | ||
|
||
bench.bytes = N as u64; | ||
} | ||
|
||
benchmark_group!(benches, a, b); | ||
benchmark_main!(benches); | ||
use criterion_bencher_compat::Bencher; | ||
|
||
fn a(bench: &mut Bencher) { | ||
bench.iter(|| (0..1000).fold(0, |x, y| x + y)) | ||
} | ||
|
||
fn b(bench: &mut Bencher) { | ||
const N: usize = 1024; | ||
bench.iter(|| vec![0u8; N]); | ||
|
||
bench.bytes = N as u64; | ||
} | ||
|
||
benchmark_group!(benches, a, b); | ||
benchmark_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
use criterion::{criterion_group, Criterion, SamplingMode}; | ||
use std::thread::sleep; | ||
use std::time::Duration; | ||
|
||
fn sampling_mode_tests(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("sampling_mode"); | ||
|
||
group.sampling_mode(SamplingMode::Auto); | ||
group.bench_function("Auto", |bencher| { | ||
bencher.iter(|| sleep(Duration::from_millis(0))) | ||
}); | ||
|
||
group.sampling_mode(SamplingMode::Linear); | ||
group.bench_function("Linear", |bencher| { | ||
bencher.iter(|| sleep(Duration::from_millis(0))) | ||
}); | ||
|
||
group.sampling_mode(SamplingMode::Flat); | ||
group.bench_function("Flat", |bencher| { | ||
bencher.iter(|| sleep(Duration::from_millis(10))) | ||
}); | ||
|
||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, sampling_mode_tests,); | ||
use criterion::{criterion_group, Criterion, SamplingMode}; | ||
use std::thread::sleep; | ||
use std::time::Duration; | ||
|
||
fn sampling_mode_tests(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("sampling_mode"); | ||
|
||
group.sampling_mode(SamplingMode::Auto); | ||
group.bench_function("Auto", |bencher| bencher.iter(|| sleep(Duration::from_millis(0)))); | ||
|
||
group.sampling_mode(SamplingMode::Linear); | ||
group.bench_function("Linear", |bencher| bencher.iter(|| sleep(Duration::from_millis(0)))); | ||
|
||
group.sampling_mode(SamplingMode::Flat); | ||
group.bench_function("Flat", |bencher| bencher.iter(|| sleep(Duration::from_millis(10)))); | ||
|
||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, sampling_mode_tests,); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[book] | ||
title = "Criterion.rs Documentation" | ||
description = "User Guide and Other Prose Documentation For Criterion.rs" | ||
author = "Brook Heisler" | ||
|
||
[output.html] | ||
|
||
[output.linkcheck] | ||
#follow-web-links = true | ||
exclude = [ 'crates\.io' ] | ||
[book] | ||
title = "Criterion.rs Documentation" | ||
description = "User Guide and Other Prose Documentation For Criterion.rs" | ||
author = "Brook Heisler" | ||
|
||
[output.html] | ||
|
||
[output.linkcheck] | ||
#follow-web-links = true | ||
exclude = ['crates\.io'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.