summaryrefslogtreecommitdiff
path: root/tests/src/benches.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/benches.rs')
-rw-r--r--tests/src/benches.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/src/benches.rs b/tests/src/benches.rs
index 21fdbc7a..b1e77692 100644
--- a/tests/src/benches.rs
+++ b/tests/src/benches.rs
@@ -80,17 +80,17 @@ fn bench_typeset(iai: &mut Iai) {
)
.unwrap();
let content = module.content();
- iai.run(|| typst::model::typeset(world.track(), &content));
+ iai.run(|| typst::model::typeset(world.track(), tracer.track_mut(), &content));
}
fn bench_compile(iai: &mut Iai) {
let world = BenchWorld::new();
- iai.run(|| typst::compile(&world, &world.source));
+ iai.run(|| typst::compile(&world));
}
fn bench_render(iai: &mut Iai) {
let world = BenchWorld::new();
- let document = typst::compile(&world, &world.source).unwrap();
+ let document = typst::compile(&world).unwrap();
iai.run(|| typst::export::render(&document.pages[0], 1.0, Color::WHITE))
}
@@ -124,6 +124,18 @@ impl World for BenchWorld {
&self.library
}
+ fn main(&self) -> &Source {
+ &self.source
+ }
+
+ fn resolve(&self, path: &Path) -> FileResult<SourceId> {
+ Err(FileError::NotFound(path.into()))
+ }
+
+ fn source(&self, _: SourceId) -> &Source {
+ &self.source
+ }
+
fn book(&self) -> &Prehashed<FontBook> {
&self.book
}
@@ -135,12 +147,4 @@ impl World for BenchWorld {
fn file(&self, path: &Path) -> FileResult<Buffer> {
Err(FileError::NotFound(path.into()))
}
-
- fn resolve(&self, path: &Path) -> FileResult<SourceId> {
- Err(FileError::NotFound(path.into()))
- }
-
- fn source(&self, _: SourceId) -> &Source {
- unimplemented!()
- }
}