mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-10 17:32:13 -04:00
blake3: add to requirements and borg benchmark cpu
This commit is contained in:
parent
adf7352695
commit
75d67d196d
2 changed files with 7 additions and 2 deletions
|
|
@ -42,6 +42,7 @@ dependencies = [
|
|||
"xxhash>=2.0.0",
|
||||
"jsonargparse>=4.47.0",
|
||||
"PyYAML>=6.0.2", # we need to register our types with yaml, jsonargparse uses yaml for config files
|
||||
"blake3>=1.0.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
|
|
|||
|
|
@ -232,16 +232,20 @@ class BenchmarkMixIn:
|
|||
print(f"{spec:<24} {format_file_size(size):<10} {dt:.3f}s")
|
||||
|
||||
from ..crypto.low_level import hmac_sha256, blake2b_256
|
||||
import blake3
|
||||
|
||||
if not args.json:
|
||||
print("Cryptographic hashes / MACs ====================================")
|
||||
else:
|
||||
result["hashes"] = []
|
||||
size = 1000000000
|
||||
for spec, func in [
|
||||
hashes_tests = [
|
||||
("hmac-sha256", lambda: hmac_sha256(key_256, random_10M)),
|
||||
("blake2b-256", lambda: blake2b_256(key_256, random_10M)),
|
||||
]:
|
||||
("blake3", lambda: blake3.blake3(random_10M, key=key_256).digest()),
|
||||
("blake3-mt", lambda: blake3.blake3(random_10M, key=key_256, max_threads=blake3.blake3.AUTO).digest()),
|
||||
]
|
||||
for spec, func in hashes_tests:
|
||||
dt = timeit(func, number=number_default)
|
||||
if args.json:
|
||||
result["hashes"].append({"algo": spec, "size": size, "time": dt})
|
||||
|
|
|
|||
Loading…
Reference in a new issue