moved all crates into seperate folder + related path fixes

This commit is contained in:
Anton-4 2022-07-01 17:37:43 +02:00
parent 12ef03bb86
commit eee85fa45d
No known key found for this signature in database
GPG key ID: C954D6E0F9C0ABFD
1063 changed files with 92 additions and 93 deletions

View file

@ -0,0 +1,37 @@
use bumpalo::Bump;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use roc_parse::{module, module::module_defs, parser::Parser, state::State};
pub fn criterion_benchmark(c: &mut Criterion) {
let mut path = std::env::current_dir()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap()
.to_owned();
path.push("examples");
path.push("false-interpreter");
path.push("False.roc");
let src = std::fs::read_to_string(&path).unwrap();
c.bench_function("parse false-interpreter", |b| {
b.iter(|| {
let arena = Bump::new();
let (_actual, state) =
module::parse_header(&arena, State::new(src.as_bytes())).unwrap();
let res = module_defs()
.parse(&arena, state)
.map(|tuple| tuple.1)
.unwrap();
black_box(res.len());
})
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);