Skip to content

Commit c8c1100

Browse files
committed
---
yaml --- r: 31667 b: refs/heads/dist-snap c: c973732 h: refs/heads/master i: 31665: d039668 31663: 2e82b1e v: v3
1 parent d10a2c0 commit c8c1100

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 517ad983f9f5ac7f805dd15cf6c6a156e02e3ec8
10+
refs/heads/dist-snap: c973732a23da75b09dd6d35ce6f951c8bcd6cb01
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/test/bench/pingpong.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Compare bounded and unbounded protocol performance.
22

3-
// xfail-test
43
// xfail-pretty
54

65
use std;
@@ -33,31 +32,35 @@ proto! pingpong_unbounded {
3332
}
3433

3534
// This stuff should go in libcore::pipes
36-
macro_rules! move {
37-
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
35+
macro_rules! move_it {
36+
{ $x:expr } => { let t <- *ptr::addr_of($x); t }
3837
}
3938

4039
macro_rules! follow {
4140
{
4241
$($message:path($($x: ident),+) -> $next:ident $e:expr)+
4342
} => (
44-
|m| alt move(m) {
45-
$(some($message($($x,)* next)) {
46-
let $next = move!{next};
47-
$e })+
48-
_ { fail }
43+
|m| alt move m {
44+
$(some($message($($x,)* next)) => {
45+
// FIXME (#2329) use regular move here once move out of
46+
// enums is supported.
47+
let $next = unsafe { move_it!(next) };
48+
$e })+
49+
_ => { fail }
4950
}
5051
);
5152

5253
{
5354
$($message:path -> $next:ident $e:expr)+
5455
} => (
55-
|m| alt move(m) {
56-
$(some($message(next)) {
57-
let $next = move!{next};
56+
|m| alt move m {
57+
$(some($message(next)) => {
58+
// FIXME (#2329) use regular move here once move out of
59+
// enums is supported.
60+
let $next = unsafe { move_it!(next) };
5861
$e })+
59-
_ { fail }
60-
}
62+
_ => { fail }
63+
}
6164
)
6265
}
6366

@@ -66,8 +69,6 @@ fn switch<T: send, Tb: send, U>(+endp: pipes::recv_packet_buffered<T, Tb>,
6669
f(pipes::try_recv(endp))
6770
}
6871

69-
fn move<T>(-x: T) -> T { x }
70-
7172
// Here's the benchmark
7273

7374
fn bounded(count: uint) {
@@ -132,7 +133,11 @@ fn timeit(f: fn()) -> float {
132133
}
133134

134135
fn main() {
135-
let count = 1000000;
136+
let count = if os::getenv(~"RUST_BENCH").is_some() {
137+
250000
138+
} else {
139+
100
140+
};
136141
let bounded = do timeit { bounded(count) };
137142
let unbounded = do timeit { unbounded(count) };
138143

0 commit comments

Comments
 (0)