mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
decrypting benchmark
This commit is contained in:
parent
b44f1c84de
commit
250432a3f4
1 changed files with 9 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue