rust-hashlib-testing/tests/test_benchmark.py

14 lines
292 B
Python
Raw Permalink Normal View History

2022-07-10 21:15:40 +01:00
import rust_hashlib_testing
import hashlib
def do_hash(hasher, data):
h = hasher()
h.update(data)
return h.digest()
def test_rust(benchmark):
benchmark(do_hash, rust_hashlib_testing.Sha512, b"123")
def test_python(benchmark):
benchmark(do_hash, hashlib.sha512, b"123")