summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-09-11 20:58:42 -0400
committerOri Bernstein <ori@eigenstate.org>2014-09-11 20:58:42 -0400
commit4a494e3b48d42de7b8316edd82a1fb4a7400ca3b (patch)
tree63b2b36d6e19441648a7c4214b2c9a5c72ba632d /bench
parentfb881a4e58df2e5cd0ec824024e63db0811f5dcc (diff)
downloadmc-4a494e3b48d42de7b8316edd82a1fb4a7400ca3b.tar.gz
Add sha1 benchmark.
Diffstat (limited to 'bench')
-rw-r--r--bench/Makefile1
-rw-r--r--bench/sha1-compute.myr20
2 files changed, 21 insertions, 0 deletions
diff --git a/bench/Makefile b/bench/Makefile
index 28853c4..4a15fd9 100644
--- a/bench/Makefile
+++ b/bench/Makefile
@@ -2,6 +2,7 @@ BIN=runner
OBJ=runner.o
BENCHSRC=intsort.myr \
copious-allocs.myr \
+ sha1-compute.myr \
include ../config.mk
include ../mk/c.mk
diff --git a/bench/sha1-compute.myr b/bench/sha1-compute.myr
new file mode 100644
index 0000000..22e9a9b
--- /dev/null
+++ b/bench/sha1-compute.myr
@@ -0,0 +1,20 @@
+use cryptohash
+use std
+
+const N = 20
+const main = {
+ var i, b
+ var buf : byte[1024*1024]
+ var st
+
+ b = 0
+ for i = 0; i < buf.len; i++
+ buf[i] = b++
+ ;;
+ for i = 0; i < N; i++
+ cryptohash.sha1init(&st)
+ cryptohash.sha1add(&st, buf[:])
+ cryptohash.sha1fin(&st)
+ ;;
+}
+