diff --git a/Cargo.lock b/Cargo.lock index 50660bb..2a068cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,7 +393,6 @@ dependencies = [ "num-complex", "num-traits", "oorandom", - "plotters", "quickcheck", "rand", "rayon", @@ -881,34 +880,6 @@ dependencies = [ "futures-io", ] -[[package]] -name = "plotters" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" - -[[package]] -name = "plotters-svg" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" -dependencies = [ - "plotters-backend", -] - [[package]] name = "polling" version = "2.8.0" diff --git a/Cargo.toml b/Cargo.toml index 5c3400c..405a494 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,11 +50,6 @@ tokio = { version = "1.37", default-features = false, features = [ "rt", ], optional = true } async-std = { version = "1.12", optional = true } -plotters = { version = "^0.3.5", default-features = false, features = [ - "svg_backend", - "area_series", - "line_series", -], optional = true } codspeed = { version = "2.6.0", optional = true } colored = { version = "2.1.0", optional = true } @@ -80,7 +75,7 @@ stable = [ "async_tokio", "async_std", ] -default = ["rayon", "plotters", "cargo_bench_support"] +default = ["rayon", "cargo_bench_support"] ## Enables [codspeed](https://codspeed.io) codspeed = ["dep:codspeed", "dep:colored"] diff --git a/src/analysis/mod.rs b/src/analysis/mod.rs index 87601a1..d57a956 100644 --- a/src/analysis/mod.rs +++ b/src/analysis/mod.rs @@ -90,7 +90,6 @@ pub(crate) fn common( id: id.into(), iters: &iters, times: ×, - plot_config: (&report_context.plot_config).into(), sampling_method: sampling_mode.into(), benchmark_config: config.into(), }) diff --git a/src/benchmark.rs b/src/benchmark.rs index 8b80840..673eb8d 100644 --- a/src/benchmark.rs +++ b/src/benchmark.rs @@ -1,4 +1,4 @@ -use crate::{PlotConfiguration, SamplingMode}; +use crate::SamplingMode; use std::time::Duration; // TODO: Move the benchmark config stuff to a separate module for easier use. @@ -44,7 +44,6 @@ pub(crate) struct PartialBenchmarkConfig { pub(crate) warm_up_time: Option, pub(crate) sampling_mode: Option, pub(crate) quick_mode: Option, - pub(crate) plot_config: PlotConfiguration, } impl PartialBenchmarkConfig { diff --git a/src/benchmark_group.rs b/src/benchmark_group.rs index 6395f08..6ce2d89 100644 --- a/src/benchmark_group.rs +++ b/src/benchmark_group.rs @@ -10,7 +10,7 @@ use crate::report::BenchmarkId as InternalBenchmarkId; use crate::report::Report; use crate::report::ReportContext; use crate::routine::{Function, Routine}; -use crate::{Mode, PlotConfiguration, SamplingMode, Throughput}; +use crate::{Mode, SamplingMode, Throughput}; /// Structure used to group together a set of related benchmarks, along with custom configuration /// settings for groups of benchmarks. All benchmarks performed using a benchmark group will be @@ -218,12 +218,6 @@ impl<'a, M: Measurement> BenchmarkGroup<'a, M> { self } - /// Changes the plot configuration for this benchmark group. - pub fn plot_config(&mut self, new_config: PlotConfiguration) -> &mut Self { - self.partial_config.plot_config = new_config; - self - } - /// Set the input size for this benchmark group. Used for reporting the /// throughput. pub fn throughput(&mut self, throughput: Throughput) -> &mut Self { @@ -278,10 +272,8 @@ impl<'a, M: Measurement> BenchmarkGroup<'a, M> { I: ?Sized, { let config = self.partial_config.to_complete(&self.criterion.config); - let report_context = ReportContext { - output_directory: self.criterion.output_directory.clone(), - plot_config: self.partial_config.plot_config.clone(), - }; + let report_context = + ReportContext { output_directory: self.criterion.output_directory.clone() }; let mut id = InternalBenchmarkId::new( self.group_name.clone(), @@ -378,10 +370,8 @@ impl<'a, M: Measurement> Drop for BenchmarkGroup<'a, M> { } if self.all_ids.len() > 1 && self.any_matched && self.criterion.mode.is_benchmark() { - let report_context = ReportContext { - output_directory: self.criterion.output_directory.clone(), - plot_config: self.partial_config.plot_config.clone(), - }; + let report_context = + ReportContext { output_directory: self.criterion.output_directory.clone() }; self.criterion.report.summarize( &report_context, diff --git a/src/cli.rs b/src/cli.rs index c263335..ed47251 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,4 +1,4 @@ -use crate::{report::CliVerbosity, BenchmarkConfig, ListFormat, PlottingBackend}; +use crate::{report::CliVerbosity, BenchmarkConfig, ListFormat}; use bpaf::*; use std::{str::FromStr, time::Duration}; @@ -20,7 +20,6 @@ pub struct Opts { pub noise_threshold: f64, pub confidence_level: f64, pub significance_level: f64, - pub plotting_backend: Option, pub output_format: OutputFormat, // ignored @@ -274,13 +273,6 @@ pub fn options(config: &BenchmarkConfig) -> OptionParser { .help("Ignored, but added for compatibility with libsets.") .switch() .hide(); - let plotting_backend = long("plotting-backend") - .help( - "Set the plotting backend. By default, Criterion.rs will use the gnuplot backend \ - if gnuplot is available, or the plotters backend if it isn't.", - ) - .argument("PLOT") - .optional(); let output_format = long("output-format") @@ -294,7 +286,6 @@ pub fn options(config: &BenchmarkConfig) -> OptionParser { warm_up_time, measurement_time, nresamples, noise_threshold, confidence_level, significance_level, nocapture, show_output, include_ignored, - plotting_backend, output_format, ignored, exact, filter}) .to_options() diff --git a/src/codspeed/benchmark_group.rs b/src/codspeed/benchmark_group.rs index 3f3dc50..1fc06d5 100644 --- a/src/codspeed/benchmark_group.rs +++ b/src/codspeed/benchmark_group.rs @@ -4,7 +4,7 @@ use std::{cell::RefCell, rc::Rc, time::Duration}; use codspeed::{codspeed::CodSpeed, utils::get_git_relative_path}; use crate::measurement::WallTime; -use crate::{measurement::Measurement, PlotConfiguration, SamplingMode, Throughput}; +use crate::{measurement::Measurement, SamplingMode, Throughput}; use super::bencher::Bencher; use super::criterion::Criterion; @@ -109,9 +109,6 @@ impl<'a, M: Measurement> BenchmarkGroup<'a, M> { pub fn sampling_mode(&mut self, new_mode: SamplingMode) -> &mut Self { self } - pub fn plot_config(&mut self, new_config: PlotConfiguration) -> &mut Self { - self - } pub fn finish(self) {} } diff --git a/src/codspeed/criterion.rs b/src/codspeed/criterion.rs index 9bfc125..41a35e4 100644 --- a/src/codspeed/criterion.rs +++ b/src/codspeed/criterion.rs @@ -3,7 +3,6 @@ use std::{cell::RefCell, marker::PhantomData, rc::Rc, time::Duration}; use crate::{ measurement::{Measurement, WallTime}, profiler::Profiler, - PlottingBackend, }; use codspeed::codspeed::CodSpeed; @@ -106,9 +105,6 @@ impl Criterion { pub fn with_profiler(self, p: P) -> Criterion { self } - pub fn plotting_backend(mut self, backend: PlottingBackend) -> Criterion { - self - } pub fn sample_size(mut self, n: usize) -> Criterion { self } @@ -130,15 +126,6 @@ impl Criterion { pub fn significance_level(mut self, sl: f64) -> Criterion { self } - pub fn with_plots(mut self) -> Criterion { - self - } - pub fn without_plots(mut self) -> Criterion { - self - } - pub fn can_plot(&self) -> bool { - true - } pub fn save_baseline(mut self, baseline: String) -> Criterion { self } diff --git a/src/connection.rs b/src/connection.rs index 4f85912..2c592e8 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -234,7 +234,6 @@ pub enum OutgoingMessage<'a> { id: RawBenchmarkId, iters: &'a [f64], times: &'a [f64], - plot_config: PlotConfiguration, sampling_method: SamplingMethod, benchmark_config: BenchmarkConfig, }, @@ -288,12 +287,6 @@ impl From for AxisScale { pub struct PlotConfiguration { summary_scale: AxisScale, } -impl From<&crate::PlotConfiguration> for PlotConfiguration { - fn from(other: &crate::PlotConfiguration) -> Self { - PlotConfiguration { summary_scale: other.summary_scale.into() } - } -} - #[derive(Debug, Serialize)] struct Duration { secs: u64, diff --git a/src/criterion.rs b/src/criterion.rs index 60f587c..03fb992 100644 --- a/src/criterion.rs +++ b/src/criterion.rs @@ -8,10 +8,9 @@ use std::time::Duration; use crate::bencher::Bencher; use crate::benchmark_group::{BenchmarkGroup, BenchmarkId}; use crate::{ - cargo_criterion_connection, debug_enabled, default_output_directory, default_plotting_backend, - gnuplot_version, Baseline, BencherReport, BenchmarkConfig, BenchmarkFilter, CliReport, - CliVerbosity, Connection, ExternalProfiler, Html, Measurement, Mode, OutgoingMessage, - PlotConfiguration, PlottingBackend, Profiler, Report, ReportContext, Reports, WallTime, + cargo_criterion_connection, debug_enabled, default_output_directory, Baseline, BencherReport, + BenchmarkConfig, BenchmarkFilter, CliReport, CliVerbosity, Connection, ExternalProfiler, + Measurement, Mode, OutgoingMessage, Profiler, Report, ReportContext, Reports, WallTime, }; /// The benchmark manager @@ -62,7 +61,6 @@ impl Default for Criterion { cli: CliReport::new(false, false, CliVerbosity::Normal), bencher_enabled: false, bencher: BencherReport, - html: default_plotting_backend().create_plotter().map(Html::new), csv_enabled: cfg!(feature = "csv_output"), }; @@ -87,7 +85,6 @@ impl Default for Criterion { criterion.report.cli_enabled = false; criterion.report.bencher_enabled = false; criterion.report.csv_enabled = false; - criterion.report.html = None; } criterion } @@ -122,25 +119,6 @@ impl Criterion { Criterion { profiler: Box::new(RefCell::new(p)), ..self } } - #[must_use] - /// Set the plotting backend. By default, Criterion will use gnuplot if available, or plotters - /// if not. - /// - /// Panics if `backend` is `PlottingBackend::Gnuplot` and gnuplot is not available. - pub fn plotting_backend(mut self, backend: PlottingBackend) -> Criterion { - if let PlottingBackend::Gnuplot = backend { - assert!( - !gnuplot_version().is_err(), - "Gnuplot plotting backend was requested, but gnuplot is not available. \ - To continue, either install Gnuplot or allow Criterion.rs to fall back \ - to using plotters." - ); - } - - self.report.html = backend.create_plotter().map(Html::new); - self - } - #[must_use] /// Changes the default size of the sample for benchmarks run with this runner. /// @@ -279,28 +257,6 @@ impl Criterion { self } - #[must_use] - /// Enables plotting - pub fn with_plots(mut self) -> Criterion { - // If running under cargo-criterion then don't re-enable the reports; let it do the reporting. - if self.connection.is_none() && self.report.html.is_none() { - let default_backend = default_plotting_backend().create_plotter(); - if let Some(backend) = default_backend { - self.report.html = Some(Html::new(backend)); - } else { - panic!("Cannot find a default plotting backend!"); - } - } - self - } - - #[must_use] - /// Disables plotting - pub fn without_plots(mut self) -> Criterion { - self.report.html = None; - self - } - #[must_use] /// Names an explicit baseline and enables overwriting the previous results. pub fn save_baseline(mut self, baseline: String) -> Criterion { @@ -362,10 +318,7 @@ impl Criterion { return; } - let report_context = ReportContext { - output_directory: self.output_directory.clone(), - plot_config: PlotConfiguration::default(), - }; + let report_context = ReportContext { output_directory: self.output_directory.clone() }; self.report.final_summary(&report_context); } @@ -387,12 +340,6 @@ impl Criterion { if opts.verbosity == CliVerbosity::Verbose { eprintln!("Warning: --verbose will be ignored when running with cargo-criterion. Use `cargo criterion --output-format verbose -- ` instead."); } - if opts.noplot { - eprintln!("Warning: --noplot will be ignored when running with cargo-criterion. Use `cargo criterion --plotting-backend disabled -- ` instead."); - } - if let Some(backend) = opts.plotting_backend { - eprintln!("Warning: --plotting-backend will be ignored when running with cargo-criterion. Use `cargo criterion --plotting-backend {} -- ` instead.", backend); - } if opts.output_format != OutputFormat::Criterion { eprintln!("Warning: --output-format will be ignored when running with cargo-criterion. Use `cargo criterion --output-format {} -- ` instead.", opts.output_format); } @@ -432,14 +379,6 @@ impl Criterion { }; self = self.with_benchmark_filter(filter); - if let Some(backend) = opts.plotting_backend { - self = self.plotting_backend(backend) - }; - - if opts.noplot { - self = self.without_plots(); - } - match opts.baseline { Baseline_::Save(ref dir) => { self.baseline = Baseline::Save; @@ -463,7 +402,6 @@ impl Criterion { self.report.cli_enabled = false; self.report.bencher_enabled = false; self.report.csv_enabled = false; - self.report.html = None; } else { match opts.output_format { OutputFormat::Bencher => { diff --git a/src/criterion_plot/axis.rs b/src/criterion_plot/axis.rs deleted file mode 100644 index 83f751a..0000000 --- a/src/criterion_plot/axis.rs +++ /dev/null @@ -1,198 +0,0 @@ -//! Coordinate axis - -use std::borrow::Cow; -use std::iter::IntoIterator; - -use super::map; -use super::traits::{Configure, Data, Set}; -use super::{ - grid, Axis, Default, Display, Grid, Label, Range, Scale, ScaleFactor, Script, TicLabels, -}; - -/// Properties of the coordinate axes -#[derive(Clone)] -pub struct Properties { - grids: map::grid::Map, - hidden: bool, - label: Option>, - logarithmic: bool, - range: Option<(f64, f64)>, - scale_factor: f64, - tics: Option, -} - -impl Default for Properties { - fn default() -> Properties { - Properties { - grids: map::grid::Map::new(), - hidden: false, - label: None, - logarithmic: false, - range: None, - scale_factor: 1., - tics: None, - } - } -} - -impl Properties { - /// Hides the axis - /// - /// **Note** The `TopX` and `RightY` axes are hidden by default - pub fn hide(&mut self) -> &mut Properties { - self.hidden = true; - self - } - - /// Makes the axis visible - /// - /// **Note** The `BottomX` and `LeftY` axes are visible by default - pub fn show(&mut self) -> &mut Properties { - self.hidden = false; - self - } -} - -impl Configure for Properties { - type Properties = grid::Properties; - - /// Configures the gridlines - fn configure(&mut self, grid: Grid, configure: F) -> &mut Properties - where - F: FnOnce(&mut grid::Properties) -> &mut grid::Properties, - { - if self.grids.contains_key(grid) { - configure(self.grids.get_mut(grid).unwrap()); - } else { - let mut properties = Default::default(); - configure(&mut properties); - self.grids.insert(grid, properties); - } - - self - } -} - -impl Set