Hi Drizzle,

During a merge request for:

  https://blueprints.launchpad.net/drizzle/+spec/replace-macro-functions

Stewart questioned updates of SHA1, see:

https://code.launchpad.net/~gthorslund/drizzle/replace-macro-functions/+merge/39894

I've done some benchmarking now. Attached test case. Unpack and do:

  shell> ./run_bench.sh

Should give a result like:

----------------------------------------
-O0 sha1
-rwxr-xr-x 1 gustaf gustaf 23748 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf 10928 2010-11-05 17:33 sha1.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.836730975
----------------------------------------
-O0 sha1-inline-static
-rwxr-xr-x 1 gustaf gustaf 24286 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  8976 2010-11-05 17:33 sha1-inline-static.o
b43859b53bf90da1951b6ab59cc964f3a8671a
3.391155227
----------------------------------------
-O1 sha1
-rwxr-xr-x 1 gustaf gustaf 18821 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  7936 2010-11-05 17:33 sha1.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.248819991
----------------------------------------
-O1 sha1-inline-static
-rwxr-xr-x 1 gustaf gustaf 18835 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  7952 2010-11-05 17:33 sha1-inline-static.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.247948874
----------------------------------------
-O2 sha1
-rwxr-xr-x 1 gustaf gustaf 22969 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  8976 2010-11-05 17:33 sha1.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.353121104
----------------------------------------
-O2 sha1-inline-static
-rwxr-xr-x 1 gustaf gustaf 22983 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  8992 2010-11-05 17:33 sha1-inline-static.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.350880366
----------------------------------------
-O3 sha1
-rwxr-xr-x 1 gustaf gustaf 22969 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  9288 2010-11-05 17:33 sha1.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.351405901
----------------------------------------
-O3 sha1-inline-static
-rwxr-xr-x 1 gustaf gustaf 22983 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  9304 2010-11-05 17:33 sha1-inline-static.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.348646827
----------------------------------------
-Os sha1
-rwxr-xr-x 1 gustaf gustaf 18583 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  8776 2010-11-05 17:33 sha1.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.337403311
----------------------------------------
-Os sha1-inline-static
-rwxr-xr-x 1 gustaf gustaf 18807 2010-11-05 17:33 benchmark_sha1
-rw-r--r-- 1 gustaf gustaf  7248 2010-11-05 17:33 sha1-inline-static.o
b43859b53bf90da1951b6ab59cc964f3a8671a
0.602943397

So except for -O0 and -Os they give similar results. Interesting -O1
goes fastest.

I removed the code from my branch before merging, but I can put it in a
separate branch if interesting.

Someone might also be interested in comparing with other implementations
of SHA1.

/Gustaf

Attachment: sha1_test.tar.bz2
Description: application/bzip

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to