diff options
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 + |