chore: bench for gen-checker

This commit is contained in:
felipegchi 2022-12-01 11:17:45 -03:00
parent 4a94d211d4
commit 297752fb0a
2 changed files with 25 additions and 0 deletions

View File

@ -4,6 +4,7 @@
use self::tags::EvalTag;
use self::tags::{operator_to_constructor, TermTag};
use hvm::syntax::Term;
use kind_span::Range;
use kind_tree::desugared::{self, Book, Expr};

View File

@ -175,3 +175,27 @@ fn bench_exp_pure_to_hvm(b: &mut Bencher) {
}).fold(0, |n, _| n + 1)
})
}
#[bench]
fn bench_exp_pure_gen_checker(b: &mut Bencher) {
let paths = exp_paths();
let books: Vec<_> = paths.iter().map(|x| {
let mut session = new_session();
let mut book = resolution::parse_and_store_book(&mut session, &PathBuf::from(x)).unwrap();
let result = resolution::check_unbound_top_level(&mut session, &mut book);
let book = desugar::desugar_book(session.diagnostic_sender.clone(), &book).unwrap();
assert!(result.is_ok());
(session, book)
}).collect();
b.iter(move || {
books.iter().map(move |(_, book)| {
kind_checker::gen_checker(book, book.names.keys().cloned().collect())
}).fold(0, |n, _| n + 1)
})
}