summaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-10-31 16:22:33 +0100
committerMartin Haug <mhaug@live.de>2021-11-05 13:44:49 +0100
commitc569e14c07902b23b7b3e29df4076cea1f4496cf (patch)
tree0e15d7d38df988718a6172810aa0dadf3cc9b43e /benches
parent1c0ac793d2b9c403f1a8fa60a3748f4ff8623acb (diff)
Improve error handling
Diffstat (limited to 'benches')
-rw-r--r--benches/oneshot.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/benches/oneshot.rs b/benches/oneshot.rs
index 6ce81a63..9a57825d 100644
--- a/benches/oneshot.rs
+++ b/benches/oneshot.rs
@@ -44,7 +44,13 @@ fn bench_scan(iai: &mut Iai) {
}
fn bench_tokenize(iai: &mut Iai) {
- iai.run(|| Tokens::new(black_box(SRC), black_box(TokenMode::Markup)).count());
+ iai.run(|| {
+ Tokens::new(
+ black_box(&SourceFile::detached(SRC)),
+ black_box(TokenMode::Markup),
+ )
+ .count()
+ });
}
fn bench_parse(iai: &mut Iai) {
@@ -53,7 +59,7 @@ fn bench_parse(iai: &mut Iai) {
fn bench_eval(iai: &mut Iai) {
let (mut ctx, id) = context();
- let ast = ctx.parse(id).unwrap();
+ let ast = ctx.sources.get(id).ast().unwrap();
iai.run(|| eval(&mut ctx, id, &ast).unwrap());
}