grass/benches/colors.rs
Ivan Tham edec89093b use phf for named rgba map hashing
Improves many_named_colors benchmark by ~40%.

many_named_colors       time:   [897.66 us 900.05 us 903.05 us]
                        change: [-41.299% -40.114% -38.800%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
2020-08-02 15:03:55 -04:00

27 lines
729 B
Rust

use criterion::{black_box, criterion_group, criterion_main, Criterion};
pub fn many_hsla(c: &mut Criterion) {
c.bench_function("many_hsla", |b| {
b.iter(|| {
grass::from_string(
black_box(include_str!("many_hsla.scss").to_string()),
&Default::default(),
)
})
});
}
pub fn many_named_colors(c: &mut Criterion) {
c.bench_function("many_named_colors", |b| {
b.iter(|| {
grass::from_string(
black_box(include_str!("many_named_colors.scss").to_string()),
&Default::default(),
)
})
});
}
criterion_group!(benches, many_hsla, many_named_colors,);
criterion_main!(benches);