Skip to content

Instantly share code, notes, and snippets.

@methane methane/siphash13 Secret
Last active Mar 6, 2017

Embed
What would you like to do?
## 4 bytes
X=1
./python.siphash13 -m perf timeit -s "x=bytearray(b'abcd' * $X)" -- 'bytes(x)'
./python.siphash13 -m perf timeit --compare-to `pwd`/python.default -s "x=bytearray(b'abcd' * $X)" -- 'hash(bytes(x))'
.....................
Median +- std dev: 192 ns +- 1 ns
python.default: ..................... 304 ns +- 9 ns
python.siphash13: ..................... 300 ns +- 8 ns
Median +- std dev: [python.default] 304 ns +- 9 ns -> [python.siphash13] 300 ns +- 8 ns: 1.01x faster (-1%)
Not significant!
## 8 bytes
X=2
.....................
Median +- std dev: 192 ns +- 2 ns
python.default: ..................... 304 ns +- 4 ns
python.siphash13: ..................... 297 ns +- 8 ns
Median +- std dev: [python.default] 304 ns +- 4 ns -> [python.siphash13] 297 ns +- 8 ns: 1.02x faster (-2%)
## 12 bytes
X=3
.....................
Median +- std dev: 192 ns +- 2 ns
python.default: ..................... 311 ns +- 8 ns
python.siphash13: ..................... 304 ns +- 8 ns
Median +- std dev: [python.default] 311 ns +- 8 ns -> [python.siphash13] 304 ns +- 8 ns: 1.03x faster (-2%)
## 40 bytes
X=10
.....................
Median +- std dev: 193 ns +- 2 ns
python.default: ..................... 327 ns +- 9 ns
python.siphash13: ..................... 312 ns +- 8 ns
Median +- std dev: [python.default] 327 ns +- 9 ns -> [python.siphash13] 312 ns +- 8 ns: 1.05x faster (-4%)
## 400 bytes
X=100
.....................
Median +- std dev: 200 ns +- 1 ns
python.default: ..................... 587 ns +- 12 ns
python.siphash13: ..................... 469 ns +- 7 ns
Median +- std dev: [python.default] 587 ns +- 12 ns -> [python.siphash13] 469 ns +- 7 ns: 1.25x faster (-20%)
## 4000 bytes
X=1000
.....................
Median +- std dev: 340 ns +- 14 ns
python.default: ..................... 3.26 us +- 0.03 us
python.siphash13: ..................... 2.03 us +- 0.02 us
Median +- std dev: [python.default] 3.26 us +- 0.03 us -> [python.siphash13] 2.03 us +- 0.02 us: 1.60x faster (-38%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.