summaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-20 10:04:49 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-20 10:04:49 +0200
commitc9b72aaa84bdd5f67283889a907c8416a853b73c (patch)
treec8dcefcc7efab17b29c7ce4716ed5c73230288f2 /benches
parentfcce3df093d0141c677608a74c25ea0d413c5050 (diff)
More highlighting API
Diffstat (limited to 'benches')
-rw-r--r--benches/oneshot.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/benches/oneshot.rs b/benches/oneshot.rs
index c972d1bc..6fd16d59 100644
--- a/benches/oneshot.rs
+++ b/benches/oneshot.rs
@@ -6,6 +6,7 @@ use unscanny::Scanner;
use typst::loading::MemLoader;
use typst::parse::{parse, TokenMode, Tokens};
use typst::source::SourceId;
+use typst::syntax::highlight_node;
use typst::Context;
const SRC: &str = include_str!("bench.typ");
@@ -70,7 +71,13 @@ fn bench_edit(iai: &mut Iai) {
fn bench_highlight(iai: &mut Iai) {
let (ctx, id) = context();
let source = ctx.sources.get(id);
- iai.run(|| source.highlight(0 .. source.len_bytes(), |_, _| {}));
+ iai.run(|| {
+ highlight_node(
+ source.red().as_ref(),
+ 0 .. source.len_bytes(),
+ &mut |_, _| {},
+ )
+ });
}
fn bench_eval(iai: &mut Iai) {