summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-06-10 10:48:08 -0400
committerOri Bernstein <ori@eigenstate.org>2014-06-10 10:48:08 -0400
commit3cc27c015d4354faed21058af35cf7e4a79839dd (patch)
tree2fe1db6a3f9a68f1659956527220174e4a56112d /bench
parent6ae936b5ec488d9a555afdc2943654b31ff079ab (diff)
downloadmc-3cc27c015d4354faed21058af35cf7e4a79839dd.tar.gz
Add first benchmark: integer sorting.
TODO: Figure out how to acutally run it automatically.
Diffstat (limited to 'bench')
-rw-r--r--bench/intsort.myr18
1 files changed, 18 insertions, 0 deletions
diff --git a/bench/intsort.myr b/bench/intsort.myr
new file mode 100644
index 0000000..9fdd8cc
--- /dev/null
+++ b/bench/intsort.myr
@@ -0,0 +1,18 @@
+use std
+
+const main = {
+ var a
+ var i
+ var rng
+ var t0, t1
+
+ rng = std.mksrng(123)
+ a = std.slalloc(1000000)
+ for i = 0; i < a.len; i++
+ a[i] = std.rand32(rng)
+ ;;
+ t0 = std.now()
+ std.sort(a, std.numcmp)
+ t1 = std.now()
+ std.put("time = %l\n", t1 - t0)
+}