summaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-12-20 14:18:29 +0100
committerLaurenz <laurmaedje@gmail.com>2021-12-21 00:20:24 +0100
commit11565a40b315212474f52eb576a9fd92b11f1132 (patch)
treec6b7afb35103065bc92b407094ca905bb75cfc73 /benches
parent958f74f77707340f34ee36d09492bdb74523aa2a (diff)
Set Rules Episode IX: The Rise of Testing
Diffstat (limited to 'benches')
-rw-r--r--benches/oneshot.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/benches/oneshot.rs b/benches/oneshot.rs
index 8f245b77..d3e2ff8e 100644
--- a/benches/oneshot.rs
+++ b/benches/oneshot.rs
@@ -2,8 +2,6 @@ use std::path::Path;
use iai::{black_box, main, Iai};
-use typst::eval::eval;
-use typst::layout::layout;
use typst::loading::MemLoader;
use typst::parse::{parse, Scanner, TokenMode, Tokens};
use typst::source::SourceId;
@@ -53,20 +51,14 @@ fn bench_parse(iai: &mut Iai) {
fn bench_eval(iai: &mut Iai) {
let (mut ctx, id) = context();
- let ast = ctx.sources.get(id).ast().unwrap();
- iai.run(|| eval(&mut ctx, id, &ast).unwrap());
-}
-
-fn bench_to_tree(iai: &mut Iai) {
- let (mut ctx, id) = context();
- let module = ctx.evaluate(id).unwrap();
- iai.run(|| module.node.clone().into_document());
+ iai.run(|| ctx.evaluate(id).unwrap());
}
fn bench_layout(iai: &mut Iai) {
let (mut ctx, id) = context();
- let tree = ctx.execute(id).unwrap();
- iai.run(|| layout(&mut ctx, &tree));
+ let module = ctx.evaluate(id).unwrap();
+ let tree = module.into_root();
+ iai.run(|| tree.layout(&mut ctx));
}
main!(
@@ -75,6 +67,5 @@ main!(
bench_tokenize,
bench_parse,
bench_eval,
- bench_to_tree,
bench_layout
);