shithub: mc

Download patch

ref: 869b4e253befd710b3560d5842436a8aa0008cef
parent: dabb2daaa9678d580c365399d905bbd243722596
author: Ori Bernstein <[email protected]>
date: Thu Sep 11 16:58:42 EDT 2014

Add sha1 benchmark.

--- a/bench/Makefile
+++ b/bench/Makefile
@@ -2,6 +2,7 @@
 OBJ=runner.o
 BENCHSRC=intsort.myr \
 	 copious-allocs.myr \
+	 sha1-compute.myr \
 
 include ../config.mk
 include ../mk/c.mk
--- /dev/null
+++ b/bench/sha1-compute.myr
@@ -1,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)
+	;;
+}
+