Enabling pingpong benchmark.
This commit is contained in:
parent
517ad983f9
commit
c973732a23
@ -1,6 +1,5 @@
|
|||||||
// Compare bounded and unbounded protocol performance.
|
// Compare bounded and unbounded protocol performance.
|
||||||
|
|
||||||
// xfail-test
|
|
||||||
// xfail-pretty
|
// xfail-pretty
|
||||||
|
|
||||||
use std;
|
use std;
|
||||||
@ -33,31 +32,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This stuff should go in libcore::pipes
|
// This stuff should go in libcore::pipes
|
||||||
macro_rules! move {
|
macro_rules! move_it {
|
||||||
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
|
{ $x:expr } => { let t <- *ptr::addr_of($x); t }
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! follow {
|
macro_rules! follow {
|
||||||
{
|
{
|
||||||
$($message:path($($x: ident),+) -> $next:ident $e:expr)+
|
$($message:path($($x: ident),+) -> $next:ident $e:expr)+
|
||||||
} => (
|
} => (
|
||||||
|m| alt move(m) {
|
|m| alt move m {
|
||||||
$(some($message($($x,)* next)) {
|
$(some($message($($x,)* next)) => {
|
||||||
let $next = move!{next};
|
// FIXME (#2329) use regular move here once move out of
|
||||||
$e })+
|
// enums is supported.
|
||||||
_ { fail }
|
let $next = unsafe { move_it!(next) };
|
||||||
|
$e })+
|
||||||
|
_ => { fail }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
{
|
||||||
$($message:path -> $next:ident $e:expr)+
|
$($message:path -> $next:ident $e:expr)+
|
||||||
} => (
|
} => (
|
||||||
|m| alt move(m) {
|
|m| alt move m {
|
||||||
$(some($message(next)) {
|
$(some($message(next)) => {
|
||||||
let $next = move!{next};
|
// FIXME (#2329) use regular move here once move out of
|
||||||
|
// enums is supported.
|
||||||
|
let $next = unsafe { move_it!(next) };
|
||||||
$e })+
|
$e })+
|
||||||
_ { fail }
|
_ => { fail }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,8 +69,6 @@ fn switch<T: send, Tb: send, U>(+endp: pipes::recv_packet_buffered<T, Tb>,
|
|||||||
f(pipes::try_recv(endp))
|
f(pipes::try_recv(endp))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move<T>(-x: T) -> T { x }
|
|
||||||
|
|
||||||
// Here's the benchmark
|
// Here's the benchmark
|
||||||
|
|
||||||
fn bounded(count: uint) {
|
fn bounded(count: uint) {
|
||||||
@ -132,7 +133,11 @@ fn timeit(f: fn()) -> float {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let count = 1000000;
|
let count = if os::getenv(~"RUST_BENCH").is_some() {
|
||||||
|
250000
|
||||||
|
} else {
|
||||||
|
100
|
||||||
|
};
|
||||||
let bounded = do timeit { bounded(count) };
|
let bounded = do timeit { bounded(count) };
|
||||||
let unbounded = do timeit { unbounded(count) };
|
let unbounded = do timeit { unbounded(count) };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user