Author christian.heimes
Recipients christian.heimes, cstratak, gregory.p.smith, miss-islington
Date 2020-05-23.11:21:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590232910.15.0.540748532931.issue37630@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-05-23 11:21:50christian.heimessetrecipients: + christian.heimes, gregory.p.smith, cstratak, miss-islington
2020-05-23 11:21:50christian.heimessetmessageid: <1590232910.15.0.540748532931.issue37630@roundup.psfhosted.org>
2020-05-23 11:21:50christian.heimeslinkissue37630 messages
2020-05-23 11:21:50christian.heimescreate