diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-03-25 09:21:12 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-03-25 09:21:12 +0200 |
commit | f35245d746080f4e8ba020eff66375e1a938ce52 (patch) | |
tree | 736bc347655cdf84fb2608e7cdfbfa7d5bdbf0c9 /trunk/scripts/checksum-benchmark | |
download | dimbola-master.tar.gz |
Diffstat (limited to 'trunk/scripts/checksum-benchmark')
-rwxr-xr-x | trunk/scripts/checksum-benchmark | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/trunk/scripts/checksum-benchmark b/trunk/scripts/checksum-benchmark new file mode 100755 index 0000000..5f70017 --- /dev/null +++ b/trunk/scripts/checksum-benchmark @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Compare various checksum algorithms for speed. + +set -e + +algo() +{ + printf "%6s: " "$1" + python -m timeit \ + -c \ + -s 'import hashlib' \ + -s 'data = file("test-plugins/test.cr2").read()' \ + "hashlib.new('$1', string=data)" +} + +algo md5 +algo sha1 +algo sha224 +algo sha256 +algo sha384 +algo sha512 + |