Skip to content

Commit

Permalink
Add benchmark on binary commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernauer committed Jun 12, 2024
1 parent 3ae39f3 commit f265e44
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions breakwater-parser/benches/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,6 +39,7 @@ fn compare_implementations(c: &mut Criterion) {
true,
false,
false,
false,
);
invoke_benchmark(
c,
Expand All @@ -37,6 +48,7 @@ fn compare_implementations(c: &mut Criterion) {
true,
true,
false,
false,
);
invoke_benchmark(
c,
Expand All @@ -45,6 +57,7 @@ fn compare_implementations(c: &mut Criterion) {
false,
false,
true,
false,
);
}

Expand All @@ -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],
Expand All @@ -64,6 +78,7 @@ fn invoke_benchmark(
.shuffle(shuffle)
.offset_usage(use_offset)
.gray_usage(use_gray)
.binary_usage(binary_usage)
.chunks(1)
.build(),
);
Expand All @@ -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| {
Expand Down

0 comments on commit f265e44

Please sign in to comment.