summaryrefslogtreecommitdiff
path: root/bench/copious-allocs.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-08-15 15:21:33 -0400
committerOri Bernstein <ori@eigenstate.org>2014-08-15 15:21:33 -0400
commit52af0fabaa1b7b36a1848f53b1abb4538dcebabc (patch)
tree05e0fe9334a637bcd9e6c2d61f0014545ffe629a /bench/copious-allocs.myr
parent437f6d851e88446fba90495a3175f02e8d3d390c (diff)
downloadmc-52af0fabaa1b7b36a1848f53b1abb4538dcebabc.tar.gz
Add copious allocs to benchmarks.
Diffstat (limited to 'bench/copious-allocs.myr')
-rw-r--r--bench/copious-allocs.myr28
1 files changed, 28 insertions, 0 deletions
diff --git a/bench/copious-allocs.myr b/bench/copious-allocs.myr
new file mode 100644
index 0000000..091b83b
--- /dev/null
+++ b/bench/copious-allocs.myr
@@ -0,0 +1,28 @@
+use std
+
+type blob = struct
+ x : int[10]
+;;
+
+const main = {
+ var i, j
+ var a : blob#[10000]
+
+ for j = 0; j < 100; j++
+ /* alloc forwards, dealloc forwards */
+ for i = 0; i < a.len; i++
+ a[i] = std.alloc()
+ ;;
+ for i = 0; i < a.len; i++
+ std.free(a[i])
+ ;;
+
+ /* alloc forwards, dealloc backwards */
+ for i = 0; i < a.len; i++
+ a[i] = std.alloc()
+ ;;
+ for i = a.len; i > 0; i--
+ std.free(a[i - 1])
+ ;;
+ ;;
+}