Skip to content

Commit

Permalink
Add benchmarks with SIMD optimized vb64 (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Nov 30, 2023
1 parent 14391e0 commit 4908fc9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
3 changes: 2 additions & 1 deletion cmp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ build = "build.rs"
publish = false

[dependencies]
base64 = { git = "https://github.com/alicemaz/rust-base64" }
base64 = { git = "https://github.com/marshallpierce/rust-base64" }
data-encoding = { path = "../lib" }
libc = "0.2"
vb64 = { git = "https://github.com/mcy/vb64" }

[build-dependencies]
cc = "1"
30 changes: 21 additions & 9 deletions cmp/benches/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,42 +64,54 @@ fn b05_encode_crate(b: &mut Bencher) {

#[bench]
fn b06_encode_base64(b: &mut Bencher) {
encode(b, |x| base64::encode(x));
use base64::Engine;
encode(b, |x| base64::engine::general_purpose::STANDARD.encode(x));
}

#[bench]
fn b07_decode_mut_seq_gcc(b: &mut Bencher) {
fn b07_encode_vb64(b: &mut Bencher) {
encode(b, |x| vb64::encode(x));
}

#[bench]
fn b08_decode_mut_seq_gcc(b: &mut Bencher) {
decode_mut(b, cmp::base64_decode_seq_gcc);
}

#[bench]
fn b08_decode_mut_seq_clang(b: &mut Bencher) {
fn b09_decode_mut_seq_clang(b: &mut Bencher) {
decode_mut(b, cmp::base64_decode_seq_clang);
}

#[bench]
fn b09_decode_mut_par_clang(b: &mut Bencher) {
fn b10_decode_mut_par_clang(b: &mut Bencher) {
decode_mut(b, cmp::base64_decode_par_clang);
}

#[bench]
fn b10_decode_mut_par_gcc(b: &mut Bencher) {
fn b11_decode_mut_par_gcc(b: &mut Bencher) {
decode_mut(b, cmp::base64_decode_par_gcc);
}

#[bench]
fn b11_decode_mut_crate(b: &mut Bencher) {
fn b12_decode_mut_crate(b: &mut Bencher) {
let base64_decode = |input: &[u8], output: &mut [u8]| BASE64.decode_mut(input, output);
decode_mut(b, base64_decode);
}

#[bench]
fn b12_decode_crate(b: &mut Bencher) {
fn b13_decode_crate(b: &mut Bencher) {
let base64_decode = |input: &[u8]| BASE64.decode(input);
decode(b, base64_decode);
}

#[bench]
fn b13_decode_base64(b: &mut Bencher) {
decode(b, |x| base64::decode(x));
fn b14_decode_base64(b: &mut Bencher) {
use base64::Engine;
decode(b, |x| base64::engine::general_purpose::STANDARD.decode(x));
}

#[bench]
fn b15_decode_vb64(b: &mut Bencher) {
decode(b, |x| vb64::decode(x));
}

0 comments on commit 4908fc9

Please sign in to comment.