std: add #[bench] benchmarks for global and local heaps.
This commit is contained in:
parent
e5cbede103
commit
3d5fb470fb
2 changed files with 38 additions and 0 deletions
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue