From fe5e012481f077063c55f7636de692326283aa61 Mon Sep 17 00:00:00 2001 From: Mrityunjay Raj Date: Sun, 24 May 2026 09:34:02 +0530 Subject: [PATCH 1/2] benchmark cpu: drop KDF section, kdfs are intentionally slow and not worth benchmarking --- src/borg/archiver/benchmark_cmd.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/borg/archiver/benchmark_cmd.py b/src/borg/archiver/benchmark_cmd.py index 6cf5a4f1e..b81b763f6 100644 --- a/src/borg/archiver/benchmark_cmd.py +++ b/src/borg/archiver/benchmark_cmd.py @@ -6,7 +6,6 @@ import tempfile import time from ..constants import * # NOQA -from ..crypto.key import FlexiKey from ..helpers import format_file_size, CompressionSpec from ..helpers import json_print from ..helpers import msgpack @@ -170,7 +169,6 @@ class BenchmarkMixIn: # Use minimal iterations and data size in test mode to keep CI fast. number_default = 1 if is_test else 100 number_compression = 1 if is_test else 10 - number_kdf = 1 if is_test else 5 data_size = 100 * 1000 if is_test else 10 * 1000 * 1000 random_10M = os.urandom(data_size) @@ -288,20 +286,6 @@ class BenchmarkMixIn: else: print(f"{spec:<24} {format_file_size(size):<10} {dt:.3f}s") - if not args.json: - print("KDFs (slow is GOOD, use argon2!) ===============================") - else: - result["kdf"] = [] - for spec, func in [ - ("pbkdf2", lambda: FlexiKey.pbkdf2("mypassphrase", b"salt" * 8, PBKDF2_ITERATIONS, 32)), - ("argon2", lambda: FlexiKey.argon2("mypassphrase", 64, b"S" * ARGON2_SALT_BYTES, **ARGON2_ARGS)), - ]: - dt = timeit(func, number=number_kdf) - if args.json: - result["kdf"].append({"algo": spec, "count": number_kdf, "time": dt}) - else: - print(f"{spec:<24} {number_kdf:<10} {dt:.3f}s") - if not args.json: print("Compression ====================================================") else: From fea52efd4446e65f006ca4facb2eb4f2436874a0 Mon Sep 17 00:00:00 2001 From: Mrityunjay Raj Date: Sun, 24 May 2026 10:07:34 +0530 Subject: [PATCH 2/2] benchmark cpu: remove KDF assertions from tests Co-Authored-By: Claude Sonnet 4.6 --- src/borg/testsuite/archiver/benchmark_cmd_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/borg/testsuite/archiver/benchmark_cmd_test.py b/src/borg/testsuite/archiver/benchmark_cmd_test.py index 5cfbafdd8..5d01b1cbd 100644 --- a/src/borg/testsuite/archiver/benchmark_cmd_test.py +++ b/src/borg/testsuite/archiver/benchmark_cmd_test.py @@ -53,7 +53,6 @@ def test_benchmark_cpu(archiver, monkeypatch): assert "Non-cryptographic checksums / hashes" in output assert "Cryptographic hashes / MACs" in output assert "Encryption" in output - assert "KDFs" in output assert "Compression" in output assert "msgpack" in output @@ -76,7 +75,7 @@ def test_benchmark_cpu_json(archiver, monkeypatch): for entry in result[category]: assert "algo_params" in entry # categories with "count" field - for category in ["kdf", "msgpack"]: + for category in ["msgpack"]: assert isinstance(result[category], list) assert len(result[category]) > 0 for entry in result[category]: