#charts #chart #generate-performance-png

perf-plotter

Library for generate performance chart

2 releases

Uses new Rust 2024

new 0.1.1 Mar 27, 2025
0.1.0 Mar 26, 2025

#163 in Visualization

44 downloads per month

Apache-2.0

50KB
95 lines

Rust Crate for Generating Performance Chart

This crate will generate a PNG file for how much time did your function takes for each iteration.

Example code:

use perf_plotter::generate_performance_png;

fn main() {
    let data: Vec<u32> = (1..50).collect();

    generate_performance_png(
        test_fun,
        data.into_iter(),
        std::path::Path::new("/tmp/a.png"),
        "square_sleep",
    )
    .unwrap();
}

fn test_fun(time_ms: u32) -> Option<()> {
    std::thread::sleep(std::time::Duration::from_millis(time_ms.pow(2).into()));
    Some(())
}

Dependencies

~4.5–6.5MB
~109K SLoC