From f265e44a40f3472b08fd750191db094094d22f5f Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Wed, 12 Jun 2024 13:25:35 +0200 Subject: [PATCH] Add benchmark on binary commands --- breakwater-parser/benches/parsing.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/breakwater-parser/benches/parsing.rs b/breakwater-parser/benches/parsing.rs index b43eb42..3324c5f 100644 --- a/breakwater-parser/benches/parsing.rs +++ b/breakwater-parser/benches/parsing.rs @@ -21,6 +21,16 @@ fn compare_implementations(c: &mut Criterion) { false, false, false, + false, + ); + invoke_benchmark( + c, + "parse_binary_draw_commands", + "benches/non-transparent.png", + false, + false, + false, + true, ); invoke_benchmark( c, @@ -29,6 +39,7 @@ fn compare_implementations(c: &mut Criterion) { true, false, false, + false, ); invoke_benchmark( c, @@ -37,6 +48,7 @@ fn compare_implementations(c: &mut Criterion) { true, true, false, + false, ); invoke_benchmark( c, @@ -45,6 +57,7 @@ fn compare_implementations(c: &mut Criterion) { false, false, true, + false, ); } @@ -55,6 +68,7 @@ fn invoke_benchmark( shuffle: bool, use_offset: bool, use_gray: bool, + binary_usage: bool, ) { let commands = image_handler::load( vec![image], @@ -64,6 +78,7 @@ fn invoke_benchmark( .shuffle(shuffle) .offset_usage(use_offset) .gray_usage(use_gray) + .binary_usage(binary_usage) .chunks(1) .build(), ); @@ -86,10 +101,10 @@ fn invoke_benchmark( let fb = Arc::new(FrameBuffer::new(FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT)); - #[cfg(target_arch = "x86_64")] - let parser_names = ["original", "refactored", "memchr", "assembler"]; - #[cfg(not(target_arch = "x86_64"))] - let parser_names = ["original", "refactored", "memchr"]; + let parser_names = vec!["original", "refactored" /*"memchr"*/]; + + // #[cfg(target_arch = "x86_64")] + // parser_names.push("assembler"); for parse_name in parser_names { c_group.bench_with_input(parse_name, &commands, |b, input| {