Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sha256 is ~ 6x slower than python version #91

Closed
jonalm opened this issue Nov 3, 2023 · 1 comment
Closed

sha256 is ~ 6x slower than python version #91

jonalm opened this issue Nov 3, 2023 · 1 comment

Comments

@jonalm
Copy link

jonalm commented Nov 3, 2023

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)
@jonalm
Copy link
Author

jonalm commented Nov 3, 2023

duplicate of #90

@jonalm jonalm closed this as completed Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant