Christian Heimes <li...@cheimes.de> added the comment:

OpenSSL's SHA-3 implementation is a tiny bit faster than our builtin copy of 
SHA-3.

builtin SHA-3 with PGO

$ python3 -m timeit -s "from _sha3 import sha3_256; d = b'12345678' * 1000" 
"sha3_256(d)"
10000 loops, best of 5: 20.3 usec per loop

builtin SHA-3 without PGO

$ ./python -m timeit -s "from _sha3 import sha3_256; d = b'12345678' * 1000" 
"sha3_256(d)"
10000 loops, best of 5: 21.1 usec per loop

OpenSSL SHA-3

$ ./python -m timeit -s "from _hashlib import openssl_sha3_256 as sha3_256; d = 
b'12345678' * 1000" "sha3_256(d)"
20000 loops, best of 5: 19.1 usec per loop


OpenSSL's Blake2 implementation is also a tiny bit faster. (b.copy().update() 
because the _hashlib module doesn't have fast constructor yet)

$ python3 -m timeit -s "from _blake2 import blake2b; b = blake2b(); d = 
b'12345678' * 1000" "b.copy().update(d)"
50000 loops, best of 5: 9.67 usec per loop
$ python3 -m timeit -s "from _hashlib import new; b = new('blake2b512'); d = 
b'12345678' * 1000" "b.copy().update(d)"
50000 loops, best of 5: 8.87 usec per loop

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37630>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to