Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Sep 30, 2024
1 parent cc02450 commit 3e4e161
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 29 deletions.
19 changes: 9 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,31 +164,30 @@
#[cfg(feature = "real_blackbox")]
extern crate test;

pub use peakmem_alloc::*;

pub(crate) mod bench;
/// Ids for benchmarks
pub mod bench_id;
pub(crate) mod bench_runner;
pub(crate) mod output_value;
/// The module to define custom plugins
pub mod plugins;
pub use output_value::OutputValue;
/// The module to report benchmark results
pub mod report;

pub(crate) mod bench;
pub(crate) mod bench_id;
pub(crate) mod bench_runner;
pub(crate) mod output_value;
pub(crate) mod stats;
pub(crate) mod write_results;

pub use bench::BenchResult;

mod bench_group;
mod bench_input_group;
mod config;

pub use bench::BenchResult;
pub use bench_group::BenchGroup;
pub use bench_id::BenchId;
pub use bench_input_group::InputGroup;
pub use bench_runner::BenchRunner;
pub use config::Config;
pub use output_value::OutputValue;
pub use peakmem_alloc::*;

pub(crate) use config::parse_args;

Expand Down
8 changes: 1 addition & 7 deletions src/report/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ use crate::{
};

/// The trait for reporting the results of a benchmark run.
pub trait Reporter: ReporterClone {
pub trait Reporter {
/// Report the results from a group (can be a single bench)
fn report_results(&self, results: Vec<BenchResult>, output_value_column_title: &'static str);
}

/// The trait to enable cloning on the Box reporter
pub trait ReporterClone {
/// Clone the box
fn clone_box(&self) -> Box<dyn Reporter>;
}

pub(crate) fn report_group<'a>(
runner_name: Option<&str>,
group_name: Option<&str>,
Expand Down
7 changes: 1 addition & 6 deletions src/report/plain_reporter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use yansi::Paint;

use super::{avg_median_str, memory_str, min_max_str, BenchStats, Reporter, ReporterClone};
use super::{avg_median_str, memory_str, min_max_str, BenchStats, Reporter};
use crate::bench::BenchResult;

#[derive(Clone, Copy)]
Expand All @@ -13,11 +13,6 @@ use crate::bench::BenchResult;
/// factorial 400 Avg: 107ns Median: 107ns [107ns .. 109ns]
/// ```
pub struct PlainReporter {}
impl ReporterClone for PlainReporter {
fn clone_box(&self) -> Box<dyn Reporter> {
Box::new(*self)
}
}

impl Reporter for PlainReporter {
fn report_results(&self, results: Vec<BenchResult>, output_value_column_title: &'static str) {
Expand Down
7 changes: 1 addition & 6 deletions src/report/table_reporter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{avg_median_str, memory_str, min_max_str, Reporter, ReporterClone};
use super::{avg_median_str, memory_str, min_max_str, Reporter};
use crate::bench::BenchResult;

#[derive(Clone, Copy)]
Expand All @@ -15,11 +15,6 @@ use crate::bench::BenchResult;
/// | hashmap | Memory: 84 B | 840.24 MiB/s (+1.54%) | 841.17 MiB/s (+0.33%) | [843.96 MiB/s .. 817.73 MiB/s] |
/// ```
pub struct TableReporter;
impl ReporterClone for TableReporter {
fn clone_box(&self) -> Box<dyn Reporter> {
Box::new(*self)
}
}
impl Reporter for TableReporter {
fn report_results(&self, results: Vec<BenchResult>, output_value_column_title: &'static str) {
use prettytable::*;
Expand Down

0 comments on commit 3e4e161

Please sign in to comment.