Files
tdf/benches/rendering.rs
T
itsjunetime 5825849434 - Significantly improved time to render full document
- Added support for debugging with tokio-console through tracing feature
- Added extra benchmark for checking time to render first page
- Removed unwraps to just make background loops return and terminate if something goes wrong
- Modularize rendering somewhat
2024-06-04 15:46:25 -06:00

46 lines
918 B
Rust

mod utils;
use utils::{render_doc, render_first_page};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
const FILES: [&str; 2] = [
"./benches/example_dictionary.pdf",
"./benches/adobe_example.pdf"
];
fn render_full(c: &mut Criterion) {
for file in FILES {
c.bench_with_input(
BenchmarkId::new("render_full", file),
&file,
|b, &file| b.iter(||
tokio::runtime::Runtime::new()
.unwrap()
.block_on(render_doc(file))
)
);
}
}
fn render_to_first_page(c: &mut Criterion) {
for file in FILES {
c.bench_with_input(
BenchmarkId::new("render_first_page", file),
&file,
|b, &file| b.iter(||
tokio::runtime::Runtime::new()
.unwrap()
.block_on(render_first_page(file))
)
);
}
}
criterion_group!(
name = benches;
config = Criterion::default().sample_size(10);
targets = render_full, render_to_first_page
);
criterion_main!(benches);