Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump MSRV to 1.60 for csv dependency #665

Merged
merged 5 commits into from
Apr 2, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
rust:
- stable
- 1.59 # MSRV
- 1.60.0 # MSRV
- nightly

steps:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- HTML report hidden behind non-default feature flag: 'html_reports'
- Standalone support (ie without cargo-criterion) feature flag: 'cargo_bench_support'
- MSRV bumped to 1.57
- MSRV bumped to 1.60
- `rayon` and `plotters` are optional (and default) dependencies.
- Status messages ('warming up', 'analyzing', etc) are printed to stderr, benchmark results are printed to stdout.
- Accept subsecond durations for `--warm-up-time`, `--measurement-time` and `--profile-time`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ default-features = false
features = ["svg_backend", "area_series", "line_series"]

[dev-dependencies]
tempfile = "3.2.0"
tempfile = "~3.2.0"
approx = "0.5.0"
quickcheck = { version = "1.0", default-features = false }
rand = "0.8"
Expand Down
9 changes: 5 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ install:

build: false

# Disabled in favor of github actions
test_script:
- cargo build --release
- cargo test --all --release
- cargo build --benches --all --release
# - cargo build --release
# - cargo test --all --release
# - cargo build --benches --all --release
# Disable benchmarking until performance can be improved.
# - cargo bench
- cargo doc --release --all --no-deps
# - cargo doc --release --all --no-deps

branches:
only:
Expand Down
4 changes: 2 additions & 2 deletions src/html/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ impl Report for Html {
}

let mut groups = id_groups
.into_iter()
.map(|(_, group)| BenchmarkGroup::new(output_directory, &group))
.into_values()
.map(|group| BenchmarkGroup::new(output_directory, &group))
.collect::<Vec<BenchmarkGroup<'_>>>();
groups.sort_unstable_by_key(|g| g.group_report.name);

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ pub enum PlottingBackend {
impl PlottingBackend {
fn create_plotter(&self) -> Option<Box<dyn Plotter>> {
match self {
PlottingBackend::Gnuplot => Some(Box::new(Gnuplot::default())),
PlottingBackend::Gnuplot => Some(Box::<Gnuplot>::default()),
#[cfg(feature = "plotters")]
PlottingBackend::Plotters => Some(Box::new(PlottersBackend::default())),
PlottingBackend::Plotters => Some(Box::<PlottersBackend>::default()),
#[cfg(not(feature = "plotters"))]
PlottingBackend::Plotters => panic!("Criterion was built without plotters support."),
PlottingBackend::None => None,
Expand Down Expand Up @@ -1432,7 +1432,7 @@ impl ActualSamplingMode {
}
}

(1..(n + 1) as u64).map(|a| a * d).collect::<Vec<u64>>()
(1..(n + 1)).map(|a| a * d).collect::<Vec<u64>>()
}
ActualSamplingMode::Flat => {
let n = sample_count;
Expand Down
13 changes: 5 additions & 8 deletions src/plot/gnuplot_backend/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn line_comparison(

let max = all_curves
.iter()
.map(|&&(_, ref data)| Sample::new(data).mean())
.map(|&(_, data)| Sample::new(data).mean())
.fold(::std::f64::NAN, f64::max);

let mut dummy = [1.0];
Expand Down Expand Up @@ -134,7 +134,7 @@ pub fn violin(

let kdes = all_curves
.iter()
.map(|&&(_, ref sample)| {
.map(|&(_, sample)| {
let (x, mut y) = kde::sweep(Sample::new(sample), KDE_POINTS, None);
let y_max = Sample::new(&y).max();
for y in y.iter_mut() {
Expand All @@ -144,10 +144,7 @@ pub fn violin(
(x, y)
})
.collect::<Vec<_>>();
let mut xs = kdes
.iter()
.flat_map(|&(ref x, _)| x.iter())
.filter(|&&x| x > 0.);
let mut xs = kdes.iter().flat_map(|(x, _)| x.iter()).filter(|&&x| x > 0.);
let (mut min, mut max) = {
let &first = xs.next().unwrap();
(first, first)
Expand All @@ -174,7 +171,7 @@ pub fn violin(
.configure(Axis::BottomX, |a| {
a.configure(Grid::Major, |g| g.show())
.configure(Grid::Minor, |g| g.hide())
.set(Range::Limits(0., max as f64 * one[0]))
.set(Range::Limits(0., max * one[0]))
.set(Label(format!("Average time ({})", unit)))
.set(axis_scale.to_gnuplot())
})
Expand All @@ -190,7 +187,7 @@ pub fn violin(
});

let mut is_first = true;
for (i, &(ref x, ref y)) in kdes.iter().enumerate() {
for (i, (x, y)) in kdes.iter().enumerate() {
let i = i as f64 + 0.5;
let y1: Vec<_> = y.iter().map(|&y| i + y * 0.45).collect();
let y2: Vec<_> = y.iter().map(|&y| i - y * 0.45).collect();
Expand Down
6 changes: 3 additions & 3 deletions src/plot/plotters_backend/pdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) fn pdf_comparison_figure(
let y_range = data::fitting_range(base_ys.iter().chain(ys.iter()));

let size = size.unwrap_or(SIZE);
let root_area = SVGBackend::new(&path, (size.0 as u32, size.1 as u32)).into_drawing_area();
let root_area = SVGBackend::new(&path, (size.0, size.1)).into_drawing_area();

let mut cb = ChartBuilder::on(&root_area);

Expand Down Expand Up @@ -132,7 +132,7 @@ pub(crate) fn pdf_small(
let path = context.report_path(id, "pdf_small.svg");

let size = size.unwrap_or(SIZE);
let root_area = SVGBackend::new(&path, (size.0 as u32, size.1 as u32)).into_drawing_area();
let root_area = SVGBackend::new(&path, (size.0, size.1)).into_drawing_area();

let mut chart = ChartBuilder::on(&root_area)
.margin((5).percent())
Expand Down Expand Up @@ -208,7 +208,7 @@ pub(crate) fn pdf(
let xs_ = Sample::new(&xs);

let size = size.unwrap_or(SIZE);
let root_area = SVGBackend::new(&path, (size.0 as u32, size.1 as u32)).into_drawing_area();
let root_area = SVGBackend::new(&path, (size.0, size.1)).into_drawing_area();

let range = data::fitting_range(ys.iter());

Expand Down
4 changes: 2 additions & 2 deletions src/plot/plotters_backend/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn line_comparison_series_data<'a>(
) -> (&'static str, Vec<(Option<&'a String>, Vec<f64>, Vec<f64>)>) {
let max = all_curves
.iter()
.map(|&&(_, ref data)| Sample::new(data).mean())
.map(|&(_, data)| Sample::new(data).mean())
.fold(::std::f64::NAN, f64::max);

let mut dummy = [1.0];
Expand Down Expand Up @@ -176,7 +176,7 @@ pub fn violin(

let mut xs = kdes
.iter()
.flat_map(|&(_, ref x, _)| x.iter())
.flat_map(|(_, x, _)| x.iter())
.filter(|&&x| x > 0.);
let (mut min, mut max) = {
let &first = xs.next().unwrap();
Expand Down
12 changes: 6 additions & 6 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ impl BenchmarkId {
throughput: Option<Throughput>,
) -> BenchmarkId {
let full_id = match (&function_id, &value_str) {
(&Some(ref func), &Some(ref val)) => format!("{}/{}/{}", group_id, func, val),
(&Some(ref func), &None) => format!("{}/{}", group_id, func),
(&None, &Some(ref val)) => format!("{}/{}", group_id, val),
(Some(func), Some(val)) => format!("{}/{}/{}", group_id, func, val),
(Some(func), &None) => format!("{}/{}", group_id, func),
(&None, Some(val)) => format!("{}/{}", group_id, val),
(&None, &None) => group_id.clone(),
};

Expand All @@ -129,18 +129,18 @@ impl BenchmarkId {
}

let directory_name = match (&function_id, &value_str) {
(&Some(ref func), &Some(ref val)) => format!(
(Some(func), Some(val)) => format!(
"{}/{}/{}",
make_filename_safe(&group_id),
make_filename_safe(func),
make_filename_safe(val)
),
(&Some(ref func), &None) => format!(
(Some(func), &None) => format!(
"{}/{}",
make_filename_safe(&group_id),
make_filename_safe(func)
),
(&None, &Some(ref val)) => format!(
(&None, Some(val)) => format!(
"{}/{}",
make_filename_safe(&group_id),
make_filename_safe(val)
Expand Down
17 changes: 5 additions & 12 deletions tests/criterion_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use criterion;
use serde_json;

#[cfg(feature = "plotters")]
use criterion::SamplingMode;
use criterion::{
Expand Down Expand Up @@ -84,10 +81,10 @@ fn verify_html(dir: &PathBuf, path: &str) {
}

fn verify_stats(dir: &PathBuf, baseline: &str) {
verify_json(&dir, &format!("{}/estimates.json", baseline));
verify_json(&dir, &format!("{}/sample.json", baseline));
verify_json(&dir, &format!("{}/tukey.json", baseline));
verify_json(&dir, &format!("{}/benchmark.json", baseline));
verify_json(dir, &format!("{}/estimates.json", baseline));
verify_json(dir, &format!("{}/sample.json", baseline));
verify_json(dir, &format!("{}/tukey.json", baseline));
verify_json(dir, &format!("{}/benchmark.json", baseline));
#[cfg(feature = "csv_output")]
verify_file(&dir, &format!("{}/raw.csv", baseline));
}
Expand Down Expand Up @@ -469,7 +466,7 @@ fn test_criterion_doesnt_panic_if_measured_time_is_zero() {
}

mod macros {
use super::{criterion, criterion_group, criterion_main};
use super::{criterion_group, criterion_main, Criterion};

#[test]
#[should_panic(expected = "group executed")]
Expand Down Expand Up @@ -504,8 +501,6 @@ mod macros {
#[test]
#[should_panic(expected = "group executed")]
fn criterion_group() {
use self::criterion::Criterion;

fn group(_crit: &mut Criterion) {}
fn group2(_crit: &mut Criterion) {
panic!("group executed");
Expand All @@ -519,8 +514,6 @@ mod macros {
#[test]
#[should_panic(expected = "group executed")]
fn criterion_group_trailing_comma() {
use self::criterion::Criterion;

fn group(_crit: &mut Criterion) {}
fn group2(_crit: &mut Criterion) {
panic!("group executed");
Expand Down