Skip to content

Conversation

@ThePseudo
Copy link

For performance monitoring, added benchmark for base64. Those benchmarks include testing encoding, decoding and decoding ignoring garbage characters.

These benchmarks were developed following the benchmarks in wc as examples.

@ThePseudo ThePseudo force-pushed the b64_benchmarks branch 6 times, most recently from c5d10da to 7e57b2f Compare September 29, 2025 12:31
// Benchmark different file sizes for base64 decoding
#[divan::bench(args = [10, 50, 100, 1_000, 5_000])]
fn b64_decode_synthetic(bencher: Bencher, size_mb: usize) {
let temp_dir = tempfile::tempdir().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look like it is duplicated code with the two other tests ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, I see wc_bench is also the same... but I can make a function that at least takes away the first part

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also improve wc_bench then :)

let data = text_data::generate_by_size(size_mb, 80);
let file_path = create_test_file(&data, temp_dir.path());
let file_path_str = file_path.to_str().unwrap();
let encoded_data = Command::new("base64")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not a fan of the Command call
can we call the function directly instead ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try, it needs also the configuration and I preferred using something more general...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to capture the output of this base64 encoding? This way it would save also some more code (and space on disk)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 29, 2025

CodSpeed Performance Report

Merging #8768 will not alter performance

Comparing ThePseudo:b64_benchmarks (60b9b87) with main (2dfad36)1

Summary

✅ 44 untouched
🆕 11 new
⏩ 73 skipped2

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 b64_decode_ignore_garbage_synthetic N/A 145.1 µs N/A
🆕 b64_decode_synthetic N/A 145.5 µs N/A
🆕 b64_encode_synthetic N/A 141.5 µs N/A
🆕 du_all_balanced_tree[(4, 3, 10)] N/A 1.6 ms N/A
🆕 du_all_wide_tree[(5000, 500)] N/A 18.1 ms N/A
🆕 du_balanced_tree[(5, 4, 10)] N/A 9.2 ms N/A
🆕 du_deep_tree[(100, 3)] N/A 1.1 ms N/A
🆕 du_human_balanced_tree[(5, 4, 10)] N/A 10.4 ms N/A
🆕 du_max_depth_balanced_tree[(6, 4, 10)] N/A 32.9 ms N/A
🆕 du_summarize_balanced_tree[(5, 4, 10)] N/A 8.5 ms N/A
🆕 du_wide_tree[(5000, 500)] N/A 11.3 ms N/A

Footnotes

  1. No successful run was found on main (b5ad68e) during the generation of this report, so 2dfad36 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 73 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ThePseudo ThePseudo force-pushed the b64_benchmarks branch 2 times, most recently from 51d225f to 1c20c54 Compare September 29, 2025 13:27
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor

the [[bench]] section is mandatory

@ThePseudo ThePseudo force-pushed the b64_benchmarks branch 2 times, most recently from 81246f8 to bb4513b Compare September 30, 2025 06:34
@ThePseudo
Copy link
Author

the [[bench]] section is mandatory

Yes, it was my mistake removing it, I added it back

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

For performance monitoring, added benchmark for base64. Those benchmarks
include testing encoding, decoding and decoding ignoring garbage
characters.

Signed-off-by: Andrea Calabrese <[email protected]>
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre sylvestre marked this pull request as ready for review September 30, 2025 09:57
@sylvestre sylvestre merged commit c16698f into uutils:main Sep 30, 2025
97 checks passed
@ThePseudo ThePseudo deleted the b64_benchmarks branch September 30, 2025 09:57
@sylvestre
Copy link
Contributor

actually, it failed:
could you please have a look ? thanks

Running uu_base64 base64_bench
/home/runner/work/coreutils/coreutils/target/codspeed/instrumentation/uu_base64/base64_bench: base-common-no-such-file
/home/runner/work/coreutils/coreutils/target/codspeed/instrumentation/uu_base64/base64_bench: base-common-no-such-file
/home/runner/work/coreutils/coreutils/target/codspeed/instrumentation/uu_base64/base64_bench: base-common-no-such-file
Done running base64_bench

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants