diff options
| author | mat <github@matdoes.dev> | 2022-08-28 15:10:50 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-08-28 15:10:50 -0500 |
| commit | 250432a3f42e6c19c20cf29e5953409d38af8a31 (patch) | |
| tree | a063e3bbcfb5f07ad197e32fd5b0a80aa45a97bc | |
| parent | b44f1c84de502c183a5f6c8b444a5d35c0d0378c (diff) | |
| download | azalea-drasl-250432a3f42e6c19c20cf29e5953409d38af8a31.tar.xz | |
decrypting benchmark
| -rw-r--r-- | azalea-crypto/benches/my_benchmark.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/azalea-crypto/benches/my_benchmark.rs b/azalea-crypto/benches/my_benchmark.rs index 2d255d9c..8f24cbcf 100644 --- a/azalea-crypto/benches/my_benchmark.rs +++ b/azalea-crypto/benches/my_benchmark.rs @@ -1,17 +1,23 @@ -use azalea_crypto::{create_cipher, encrypt_packet}; +use azalea_crypto::{create_cipher, decrypt_packet, encrypt_packet}; use criterion::{criterion_group, criterion_main, Criterion, Throughput}; fn bench(c: &mut Criterion) { - let (enc, dec) = create_cipher(b"0123456789abcdef"); + let (mut enc, mut dec) = create_cipher(b"0123456789abcdef"); let mut packet = [0u8; 65536]; for i in 0..packet.len() { packet[i] = i as u8; } - c.bench_function("Encrypt", |b| { + c.bench_function("Encrypt 64kb", |b| { b.iter(|| encrypt_packet(&mut enc.clone(), &mut packet.clone())) }); + + encrypt_packet(&mut enc, &mut packet); + + c.bench_function("Decrypt 64kb", |b| { + b.iter(|| decrypt_packet(&mut dec.clone(), &mut packet.clone())) + }); } criterion_group!(benches, bench); |
