Skip to main content

Crate criterion_markdown

Crate criterion_markdown 

Source
Expand description

Reads criterion benchmark results from target/criterion/ JSON files and renders a markdown table similar to criterion-table.

§Example

use criterion_markdown::{ChangeThresholds, Renderer};

fn main() -> anyhow::Result<()> {
    let thresholds = ChangeThresholds::default()
        .improvement_ratio(1.1)
        .strong_improvement_ratio(1.5)
        .regression_ratio(0.95);
    let markdown = Renderer::new("target/criterion")
        .candidate("new")
        .baseline_root("artifacts/criterion")
        .baseline("main")
        .benchmarks(["group/benchmark/1", "group/benchmark/2"])
        .change_thresholds(thresholds)
        .summary_limit(5)
        .title("Benchmark Results")
        .collapsible(true)
        .render()?;
    println!("{markdown}");
    Ok(())
}

Structs§

ChangeThresholds
Ratio thresholds controlling change indicators.
RenderOptions
Options for controlling the rendered markdown output.
Renderer
Builder for loading Criterion results and rendering them as markdown.

Functions§

render
Reads all benchmark results from the given criterion output directory and renders a markdown table.
render_with_options
Like render, but accepts additional RenderOptions to control output.