criterion.rs icon indicating copy to clipboard operation
criterion.rs copied to clipboard

Linechart is not generated

Open oknozor opened this issue 2 years ago • 2 comments

I am trying to get a linechart for the following benchmark group, but only the violin chart get generated for it. I have gnuplot installed. What I am missing ?

pub fn bench_lookups(c: &mut Criterion) {
    let mut group = c.benchmark_group("ComparisonsLookups");
    let plot_config = PlotConfiguration::default().summary_scale(AxisScale::Logarithmic);
    group.plot_config(plot_config);

    let args = [
        "user-home", // (Best case) An icon that can be found in the current theme
        "firefox",   // An icon that can be found in the hicolor default theme
        "archlinux-logo", // An icon that resides in /usr/share/pixmaps
        "not-found", // (Worst case) An icon that does not exist
    ];

    for arg in args {
        group.bench_with_input(BenchmarkId::new("freedesktop-icons", arg), arg, |b, arg| {
            b.iter(|| lookup(black_box(arg)).with_theme(black_box("Adwaita")).find());
        });

        group.bench_with_input(
            BenchmarkId::new("freedesktop-icons-cache", arg),
            arg,
            |b, arg| {
                b.iter(|| lookup(black_box(arg))
                    .with_scale(black_box(1))
                    .with_size(black_box(24))
                    .with_theme(black_box("Adwaita")).with_cache().find());
            },
        );

        group.bench_with_input(BenchmarkId::new("linicon", arg), arg, |b, arg| {
            b.iter(|| linicon::lookup_icon(black_box(arg))
                .from_theme(black_box("Adwaita"))
                .with_scale(black_box(1))
                .with_size(black_box(24))
                .next());
        });

        group.bench_with_input(BenchmarkId::new("gtk", arg), arg, |b, arg| {
            gtk4::init().unwrap();
            let theme = IconTheme::new();
            b.iter(|| {
                theme.lookup_icon(
                    black_box(arg),
                    black_box(&[]),
                    black_box(24),
                    black_box(1),
                    black_box(TextDirection::None),
                    black_box(IconLookupFlags::empty()),
                ).icon_name()
            });
        });
    }

    group.finish();
}

criterion_group!(benches, bench_lookups);
criterion_main!(benches);

oknozor avatar May 13 '22 09:05 oknozor

Thanks for the issue report, and thanks for your patience. Could you try running it with debug output enabled (https://bheisler.github.io/criterion.rs/book/criterion_rs.html#debug-output) and then share the gnuplot files that are generated? Also, have you configured it to use gnuplot? I don't see that here; the default plotting backend uses the plotters crate instead of Gnuplot.

bheisler avatar Jul 07 '22 00:07 bheisler

I just hit this also. I think the problem is that the benchmark IDs are strings, not numbers. Changing my IDs to numbers caused the line chart to be generated. For string benchmark IDs, something like a scatter plot or bar chart would be useful.

nicolasavru avatar Aug 16 '23 04:08 nicolasavru