[issue29410] Moving to SipHash-1-3
Inada Naoki
report at bugs.python.org
Thu Oct 7 04:31:29 EDT 2021
Inada Naoki <songofacandy at gmail.com> added the comment:
I am not sure this is worth doing.
Microbenchmarks:
## import time
```
$ main/opt/bin/pyperf command main/opt/bin/python3 -c 'import typing,asyncio'
.....................
command: Mean +- std dev: 49.6 ms +- 0.1 ms
$ siphash13/opt/bin/pyperf command siphash13/opt/bin/python3 -c 'import typing,asyncio'
.....................
command: Mean +- std dev: 49.3 ms +- 0.1 ms
```
0.6% faster.
## hash(s+'a')
```
# 6+1
$ siphash13/opt/bin/pyperf timeit --compare-to main/opt/bin/python3 --python-names siphash24:siphash13 -s 'b=b"x"*6' -- 'hash(b+b"a")'
siphash24: ..................... 87.7 ns +- 2.8 ns
siphash13: ..................... 84.8 ns +- 1.6 ns
Mean +- std dev: [siphash24] 87.7 ns +- 2.8 ns -> [siphash13] 84.8 ns +- 1.6 ns: 1.03x faster
# 6000+1
$ siphash13/opt/bin/pyperf timeit --compare-to main/opt/bin/python3 --python-names siphash24:siphash13 -s 'b=b"x"*6000' -- 'hash(b+b"a")'
siphash24: ..................... 2.98 us +- 0.03 us
siphash13: ..................... 1.67 us +- 0.03 us
Mean +- std dev: [siphash24] 2.98 us +- 0.03 us -> [siphash13] 1.67 us +- 0.03 us: 1.78x faster
```
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29410>
_______________________________________
More information about the Python-bugs-list
mailing list