Fix benchmarks which were not correctly measuring what they were supposed to

This commit is contained in:
itsjunetime
2024-06-08 11:36:56 -06:00
parent f893ecba4d
commit fc51bca664
4 changed files with 21 additions and 20 deletions
Generated
+14 -14
View File
@@ -256,9 +256,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.98" version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
[[package]] [[package]]
name = "cfg-expr" name = "cfg-expr"
@@ -305,18 +305,18 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.4" version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
] ]
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.2" version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"clap_lex", "clap_lex",
@@ -324,9 +324,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.7.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]] [[package]]
name = "compact_str" name = "compact_str"
@@ -1491,7 +1491,7 @@ dependencies = [
[[package]] [[package]]
name = "ratatui-image" name = "ratatui-image"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/itsjunetime/ratatui-image.git?branch=vb64_on_personal#8d368ca87c9b817811ba47d04d188a334e5da5a6" source = "git+https://github.com/itsjunetime/ratatui-image.git?branch=vb64_on_personal#395a5a2ada105fba8eeaaf20589e79fd7b8e59d8"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"dyn-clone", "dyn-clone",
@@ -1778,9 +1778,9 @@ dependencies = [
[[package]] [[package]]
name = "strum_macros" name = "strum_macros"
version = "0.26.3" version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7993a8e3a9e88a00351486baae9522c91b123a088f76469e5bd5cc17198ea87" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@@ -1991,7 +1991,7 @@ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow 0.6.11", "winnow 0.6.13",
] ]
[[package]] [[package]]
@@ -2427,9 +2427,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.11" version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c52728401e1dc672a56e81e593e912aa54c78f40246869f78359a2bf24d29d" checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
Binary file not shown.
+6 -5
View File
@@ -17,9 +17,10 @@ use utils::{
start_converting_loop, start_rendering_loop, RenderState start_converting_loop, start_rendering_loop, RenderState
}; };
const FILES: [&str; 2] = [ const FILES: [&str; 3] = [
"benches/adobe_example.pdf",
"benches/example_dictionary.pdf", "benches/example_dictionary.pdf",
"benches/adobe_example.pdf" "benches/geotopo.pdf"
]; ];
fn render_full(c: &mut Criterion) { fn render_full(c: &mut Criterion) {
@@ -32,7 +33,7 @@ fn render_full(c: &mut Criterion) {
} }
fn render_to_first_page(c: &mut Criterion) { fn render_to_first_page(c: &mut Criterion) {
for file in &FILES[..1] { for file in FILES {
c.bench_with_input( c.bench_with_input(
BenchmarkId::new("render_first_page", file), BenchmarkId::new("render_first_page", file),
&file, &file,
@@ -54,7 +55,7 @@ fn only_converting(c: &mut Criterion) {
&(all_rendered, file), &(all_rendered, file),
|b, (rendered, _)| { |b, (rendered, _)| {
b.to_async(tokio::runtime::Runtime::new().unwrap()) b.to_async(tokio::runtime::Runtime::new().unwrap())
.iter(|| convert_all_files(rendered.clone())) .iter_with_setup(|| rendered.clone(), |rendered| convert_all_files(rendered))
} }
); );
} }
@@ -70,7 +71,7 @@ pub async fn render_first_page(path: impl AsRef<Path>) {
} = start_all_rendering(path); } = start_all_rendering(path);
// we only want to render until the first page is ready to be printed // we only want to render until the first page is ready to be printed
while pages.is_empty() { while pages.iter().all(|p| p.is_none()) {
tokio::select! { tokio::select! {
Some(renderer_msg) = from_render_rx.next() => { Some(renderer_msg) = from_render_rx.next() => {
handle_renderer_msg(renderer_msg, &mut pages, &mut to_converter_tx); handle_renderer_msg(renderer_msg, &mut pages, &mut to_converter_tx);