grass/benches/numbers.rs

28 lines
838 B
Rust
Raw Normal View History

2020-05-20 00:15:05 -04:00
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use grass::StyleSheet;
pub fn many_floats(c: &mut Criterion) {
c.bench_function("many_floats", |b| {
b.iter(|| StyleSheet::new(black_box(include_str!("many_floats.scss").to_string())))
});
}
pub fn many_integers(c: &mut Criterion) {
c.bench_function("many_integers", |b| {
b.iter(|| StyleSheet::new(black_box(include_str!("many_integers.scss").to_string())))
});
}
pub fn many_small_integers(c: &mut Criterion) {
c.bench_function("many_small_integers", |b| {
b.iter(|| {
StyleSheet::new(black_box(
include_str!("many_small_integers.scss").to_string(),
))
})
});
}
criterion_group!(benches, many_floats, many_integers, many_small_integers);
criterion_main!(benches);