summaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
Diffstat (limited to 'benches')
-rw-r--r--benches/oneshot.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/benches/oneshot.rs b/benches/oneshot.rs
index 5c0fc701..fef0e6e1 100644
--- a/benches/oneshot.rs
+++ b/benches/oneshot.rs
@@ -4,10 +4,10 @@ use std::sync::Arc;
use iai::{black_box, main, Iai};
use unscanny::Scanner;
+use typst::eval::evaluate;
use typst::loading::MemLoader;
-use typst::parse::{parse, TokenMode, Tokens};
+use typst::parse::{TokenMode, Tokens};
use typst::source::SourceId;
-use typst::syntax::highlight_node;
use typst::{Config, Context};
const SRC: &str = include_str!("bench.typ");
@@ -61,7 +61,7 @@ fn bench_tokenize(iai: &mut Iai) {
}
fn bench_parse(iai: &mut Iai) {
- iai.run(|| parse(SRC));
+ iai.run(|| typst::parse::parse(SRC));
}
fn bench_edit(iai: &mut Iai) {
@@ -73,7 +73,7 @@ fn bench_highlight(iai: &mut Iai) {
let (ctx, id) = context();
let source = ctx.sources.get(id);
iai.run(|| {
- highlight_node(
+ typst::syntax::highlight_node(
source.red().as_ref(),
0 .. source.len_bytes(),
&mut |_, _| {},
@@ -83,17 +83,17 @@ fn bench_highlight(iai: &mut Iai) {
fn bench_eval(iai: &mut Iai) {
let (mut ctx, id) = context();
- iai.run(|| ctx.evaluate(id).unwrap());
+ iai.run(|| typst::eval::evaluate(&mut ctx, id, vec![]).unwrap());
}
fn bench_layout(iai: &mut Iai) {
let (mut ctx, id) = context();
- let module = ctx.evaluate(id).unwrap();
- iai.run(|| module.content.layout(&mut ctx));
+ let module = evaluate(&mut ctx, id, vec![]).unwrap();
+ iai.run(|| typst::model::layout(&mut ctx, &module.content));
}
fn bench_render(iai: &mut Iai) {
let (mut ctx, id) = context();
- let frames = ctx.typeset(id).unwrap();
+ let frames = typst::typeset(&mut ctx, id).unwrap();
iai.run(|| typst::export::render(&mut ctx, &frames[0], 1.0))
}