From eb44bdb842224e53874a9f90988d06cf28af05f0 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 19 Jul 2024 12:01:15 +0200 Subject: [PATCH] client: avoid unnecessary allocation in AES benchmark Signed-off-by: Dietmar Maurer --- proxmox-backup-client/src/benchmark.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxmox-backup-client/src/benchmark.rs b/proxmox-backup-client/src/benchmark.rs index 1262fb46..2145d45e 100644 --- a/proxmox-backup-client/src/benchmark.rs +++ b/proxmox-backup-client/src/benchmark.rs @@ -331,9 +331,10 @@ fn test_crypt_speed(benchmark_result: &mut BenchmarkResult) -> Result<(), Error> let start_time = std::time::Instant::now(); let mut bytes = 0; + let mut out = Vec::new(); loop { - let mut out = Vec::new(); DataBlob::encrypt_benchmark(&crypt_config, &random_data, &mut out)?; + out.clear(); bytes += random_data.len(); if start_time.elapsed().as_micros() > 1_000_000 { break;