diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/plotters/benches | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/plotters/benches')
-rw-r--r-- | vendor/plotters/benches/benches/data.rs | 37 | ||||
-rw-r--r-- | vendor/plotters/benches/benches/mod.rs | 1 | ||||
-rw-r--r-- | vendor/plotters/benches/main.rs | 7 |
3 files changed, 45 insertions, 0 deletions
diff --git a/vendor/plotters/benches/benches/data.rs b/vendor/plotters/benches/benches/data.rs new file mode 100644 index 000000000..22dc9f4d4 --- /dev/null +++ b/vendor/plotters/benches/benches/data.rs @@ -0,0 +1,37 @@ +use criterion::{criterion_group, Criterion}; +use plotters::data::Quartiles; + +struct Lcg { + state: u32, +} + +impl Lcg { + fn new() -> Lcg { + Lcg { state: 0 } + } +} + +impl Iterator for Lcg { + type Item = u32; + + fn next(&mut self) -> Option<u32> { + self.state = self.state.wrapping_mul(1_103_515_245).wrapping_add(12_345); + self.state %= 1 << 31; + Some(self.state) + } +} + +fn quartiles_calc(c: &mut Criterion) { + let src: Vec<u32> = Lcg::new().take(100000).collect(); + c.bench_function("data::quartiles_calc", |b| { + b.iter(|| { + Quartiles::new(&src); + }) + }); +} + +criterion_group! { + name = quartiles_group; + config = Criterion::default().sample_size(10); + targets = quartiles_calc +} diff --git a/vendor/plotters/benches/benches/mod.rs b/vendor/plotters/benches/benches/mod.rs new file mode 100644 index 000000000..7a345e4c6 --- /dev/null +++ b/vendor/plotters/benches/benches/mod.rs @@ -0,0 +1 @@ +pub mod data; diff --git a/vendor/plotters/benches/main.rs b/vendor/plotters/benches/main.rs new file mode 100644 index 000000000..f1975f5f0 --- /dev/null +++ b/vendor/plotters/benches/main.rs @@ -0,0 +1,7 @@ +use criterion::criterion_main; + +mod benches; + +criterion_main! { + benches::data::quartiles_group +} |