about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/global_heap.rs19
-rw-r--r--src/libstd/rt/local_heap.rs19
2 files changed, 38 insertions, 0 deletions
diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs
index 580390c1953..54e9cb263db 100644
--- a/src/libstd/rt/global_heap.rs
+++ b/src/libstd/rt/global_heap.rs
@@ -101,3 +101,22 @@ pub unsafe fn exchange_free_(ptr: *c_char) {
 pub unsafe fn exchange_free(ptr: *c_char) {
     free(ptr as *c_void);
 }
+
+#[cfg(test)]
+mod bench {
+    use extra::test::BenchHarness;
+
+    #[bench]
+    fn alloc_owned_small(bh: &mut BenchHarness) {
+        do bh.iter {
+            ~10;
+        }
+    }
+
+    #[bench]
+    fn alloc_owned_big(bh: &mut BenchHarness) {
+        do bh.iter {
+            ~[10, ..1000];
+        }
+    }
+}
diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs
index c909bdb6285..85917ae3edf 100644
--- a/src/libstd/rt/local_heap.rs
+++ b/src/libstd/rt/local_heap.rs
@@ -135,3 +135,22 @@ extern {
     fn rust_boxed_region_free(region: *BoxedRegion, box: *OpaqueBox);
     fn rust_current_boxed_region() -> *BoxedRegion;
 }
+
+#[cfg(test)]
+mod bench {
+    use extra::test::BenchHarness;
+
+    #[bench]
+    fn alloc_managed_small(bh: &mut BenchHarness) {
+        do bh.iter {
+            @10;
+        }
+    }
+
+    #[bench]
+    fn alloc_managed_big(bh: &mut BenchHarness) {
+        do bh.iter {
+            @[10, ..1000];
+        }
+    }
+}