feat: add cache and gtk benches comparison
This commit is contained in:
parent
e40fbfa916
commit
8de66cc58e
5 changed files with 190 additions and 45 deletions
|
|
@ -1,10 +1,9 @@
|
|||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use freedesktop_icons::lookup;
|
||||
use gtk4::{IconLookupFlags, IconTheme, TextDirection};
|
||||
|
||||
pub fn simple_lookup(c: &mut Criterion) {
|
||||
c.bench_function("lookup firefox", |b| {
|
||||
b.iter(|| lookup("firefox").find_one())
|
||||
});
|
||||
c.bench_function("lookup firefox", |b| b.iter(|| lookup("firefox").find()));
|
||||
}
|
||||
|
||||
pub fn simple_lookup_linicon(c: &mut Criterion) {
|
||||
|
|
@ -13,5 +12,27 @@ pub fn simple_lookup_linicon(c: &mut Criterion) {
|
|||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, simple_lookup, simple_lookup_linicon);
|
||||
pub fn simple_lookup_gtk(c: &mut Criterion) {
|
||||
c.bench_function("lookup firefox gkt", |b| {
|
||||
gtk4::init().unwrap();
|
||||
let theme = IconTheme::new();
|
||||
b.iter(|| {
|
||||
theme.lookup_icon(
|
||||
"firefox",
|
||||
&[],
|
||||
24,
|
||||
1,
|
||||
TextDirection::None,
|
||||
IconLookupFlags::empty(),
|
||||
)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
simple_lookup,
|
||||
simple_lookup_linicon,
|
||||
simple_lookup_gtk
|
||||
);
|
||||
criterion_main!(benches);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue