diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-25 13:50:33 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-25 13:59:06 +0200 |
| commit | c010cbc17dcbb2f0d6005d21530143bf57cb5871 (patch) | |
| tree | 937fe79f0c121bcc025480181287fd4a3d0c0f4f /benches | |
| parent | 6935cf8dfefff3d6cf234f077a7d61661fd5ca57 (diff) | |
Move route from context to VM
Diffstat (limited to 'benches')
| -rw-r--r-- | benches/oneshot.rs | 16 |
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)) } |
