sha256 is ~ 6x slower than python version
jonalm opened this issue · 1 comments
jonalm commented
On python 3.11.6
In [1]: import random
In [2]: import hashlib
In [3]: def calc_sha(bytes_):
...: sha = hashlib.sha256()
...: sha.update(bytes_)
...: return sha
...:
In [4]: bytes_ =random.randbytes(10000)
In [5]: %timeit calc_sha(bytes_)
3.93 µs ± 13.5 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
On julia 1.10 beta
julia> using SHA
julia> using BenchmarkTools
julia> @btime sha256(a) setup=a=rand(UInt8, 10000);
25.584 μs (4 allocations: 352 bytes)