chore: remove dummy benchmark

This commit is contained in:
Paul Delafosse 2022-05-13 08:36:58 +02:00
parent 5efc18bc3b
commit 058625b249

View file

@ -2,12 +2,6 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use freedesktop_icons::lookup; use freedesktop_icons::lookup;
use gtk4::{IconLookupFlags, IconTheme, TextDirection}; use gtk4::{IconLookupFlags, IconTheme, TextDirection};
pub fn simple_bench(c: &mut Criterion) {
c.bench_function("firefox lookup", |b| {
b.iter(|| lookup("firefox").with_theme("Papirus").with_cache().find())
});
}
pub fn bench_lookups(c: &mut Criterion) { pub fn bench_lookups(c: &mut Criterion) {
let mut group = c.benchmark_group("ComparisonsLookups"); let mut group = c.benchmark_group("ComparisonsLookups");
@ -15,28 +9,28 @@ pub fn bench_lookups(c: &mut Criterion) {
"user-home", // (Best case) An icon that can be found in the current theme "user-home", // (Best case) An icon that can be found in the current theme
"video-single-display-symbolic", // An icon that can be found in the parent theme "video-single-display-symbolic", // An icon that can be found in the parent theme
"firefox", // An icon that can be found in the hicolor default theme "firefox", // An icon that can be found in the hicolor default theme
"archlinux-logo", // An icon that resides in /usr/share/pixmap "archlinux-logo", // An icon that resides in /usr/share/pixmaps
"not-found", // (Worst case) An icon that does not exist "not-found", // (Worst case) An icon that does not exist
]; ];
for arg in args { for arg in args {
group.bench_with_input(BenchmarkId::new("freedesktop-icons", arg), arg, |b, arg| {
b.iter(|| lookup(arg).with_theme("Arc").find());
});
group.bench_with_input( group.bench_with_input(
BenchmarkId::new("freedesktop-icons lookup", arg), BenchmarkId::new("freedesktop-icons-cache", arg),
arg, arg,
|b, arg| { |b, arg| {
b.iter(|| lookup(arg).with_theme("Arc").find()); b.iter(|| lookup(arg).with_theme("Arc").with_cache().find());
}, },
); );
group.bench_with_input(BenchmarkId::new("lookup with cache", arg), arg, |b, arg| { group.bench_with_input(BenchmarkId::new("linicon", arg), arg, |b, arg| {
b.iter(|| lookup(arg).with_theme("Arc").with_cache().find());
});
group.bench_with_input(BenchmarkId::new("lookup linicon", arg), arg, |b, arg| {
b.iter(|| linicon::lookup_icon(arg).from_theme("Arc").next()); b.iter(|| linicon::lookup_icon(arg).from_theme("Arc").next());
}); });
group.bench_with_input(BenchmarkId::new("lookup gtk", arg), arg, |b, arg| { group.bench_with_input(BenchmarkId::new("gtk", arg), arg, |b, arg| {
gtk4::init().unwrap(); gtk4::init().unwrap();
let theme = IconTheme::new(); let theme = IconTheme::new();
b.iter(|| { b.iter(|| {