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
hash performance sha256 vs. sha512 #209
Comments
Some 32bit linux, py 2.7.6 values from a helpful guy on IRC: $ python -m timeit -r 10 -s 'from hashlib import new; h = new("sha256"); x=b"foobar"_1000000' 'h.update(x)' Vendor ID: GenuineIntel sha512 is just a little slower than sha256 there. |
Just for completeness: if anybody could post values from non-x86/amd64 platforms for 32 and/or 64bit, that would be helpful. |
Note: attic could use hmac-sha512 or hmac-sha512-256 (truncated to 256bits). |
More data from helpful IRC guy: Raspberry PI, Python 2.7.3, CPU: ARMv6-compatible processor rev 7 (v6l) $ python -m timeit -r 10 -s 'from hashlib import new; h = new("sha256"); x=b"foobar"*1000000' 'h.update(x)' $ python -m timeit -r 10 -s 'from hashlib import new; h = new("sha512"); x=b"foobar"*1000000' 'h.update(x)' So, obviously we need BOTH sha256 and sha512, for best performance depending on the CPU architecture. |
see measurements in PR #207. as there are a lot of factors contributing to backup speed, the faster hash improved speed about 2-3% for me. |
AMD Phenom(tm) II X4 810 Processor (64bit CentOS 6) SHA256 - 10 loops, best of 10: 36.5 msec per loop AMD Opteron(tm) Processor 4180 (64bit CentOS 6) SHA256 - 10 loops, best of 10: 36 msec per loop |
I just learned that sha512 is faster than sha256 (on 64bit platforms, see benchmark below). attic uses sha256 at some places, could/should it be replaced by sha512?
Attic uses hmac-sha256. I did similar measurements for hmac-sha256 and -sha512 and the speed was as shown below.
$ python3.2 -m timeit -r 10 -s 'from hashlib import new; h = new("sha256"); x=b"foobar"*1000000' 'h.update(x)'
10 loops, best of 10: 29.2 msec per loop
$ python3.2 -m timeit -r 10 -s 'from hashlib import new; h = new("sha512"); x=b"foobar"*1000000' 'h.update(x)'
100 loops, best of 10: 18.6 msec per loop
The text was updated successfully, but these errors were encountered: