Skip to content

Commit 6f13e6c

Browse files
committed
---
yaml --- r: 63600 b: refs/heads/snap-stage3 c: 3b1ace9 h: refs/heads/master v: v3
1 parent 6cc6d90 commit 6f13e6c

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a4a8a4ac277f686a4d771f1a8ce5a55b27eddf5c
4+
refs/heads/snap-stage3: 3b1ace9f9b07d59804fab1abc02ddf20b1496666
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/test/bench/shootout-binarytrees.rs

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// xfail-test
2-
3-
// Broken due to arena API problems.
4-
5-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
62
// file at the top-level directory of this distribution and at
73
// http://rust-lang.org/COPYRIGHT.
84
//
@@ -15,29 +11,29 @@
1511
extern mod extra;
1612
use extra::arena;
1713

18-
enum tree<'self> {
19-
nil,
20-
node(&'self tree<'self>, &'self tree<'self>, int),
14+
enum Tree<'self> {
15+
Nil,
16+
Node(&'self Tree<'self>, &'self Tree<'self>, int),
2117
}
2218

23-
fn item_check(t: &tree) -> int {
19+
fn item_check(t: &Tree) -> int {
2420
match *t {
25-
nil => { return 0; }
26-
node(left, right, item) => {
21+
Nil => { return 0; }
22+
Node(left, right, item) => {
2723
return item + item_check(left) - item_check(right);
2824
}
2925
}
3026
}
3127

32-
fn bottom_up_tree<'r>(arena: &'r mut arena::Arena, item: int, depth: int)
33-
-> &'r tree<'r> {
28+
fn bottom_up_tree<'r>(arena: &'r arena::Arena, item: int, depth: int)
29+
-> &'r Tree<'r> {
3430
if depth > 0 {
3531
return arena.alloc(
36-
|| node(bottom_up_tree(arena, 2 * item - 1, depth - 1),
32+
|| Node(bottom_up_tree(arena, 2 * item - 1, depth - 1),
3733
bottom_up_tree(arena, 2 * item, depth - 1),
3834
item));
3935
}
40-
return arena.alloc(|| nil);
36+
return arena.alloc(|| Nil);
4137
}
4238

4339
fn main() {
@@ -61,25 +57,25 @@ fn main() {
6157
max_depth = n;
6258
}
6359

64-
let mut stretch_arena = arena::Arena();
60+
let stretch_arena = arena::Arena();
6561
let stretch_depth = max_depth + 1;
66-
let stretch_tree = bottom_up_tree(&mut stretch_arena, 0, stretch_depth);
62+
let stretch_tree = bottom_up_tree(&stretch_arena, 0, stretch_depth);
6763

6864
println(fmt!("stretch tree of depth %d\t check: %d",
6965
stretch_depth,
7066
item_check(stretch_tree)));
7167

72-
let mut long_lived_arena = arena::Arena();
73-
let long_lived_tree = bottom_up_tree(&mut long_lived_arena, 0, max_depth);
68+
let long_lived_arena = arena::Arena();
69+
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);
7470
let mut depth = min_depth;
7571
while depth <= max_depth {
7672
let iterations = int::pow(2, (max_depth - depth + min_depth) as uint);
7773
let mut chk = 0;
7874
let mut i = 1;
7975
while i <= iterations {
80-
let mut temp_tree = bottom_up_tree(&mut long_lived_arena, i, depth);
76+
let mut temp_tree = bottom_up_tree(&long_lived_arena, i, depth);
8177
chk += item_check(temp_tree);
82-
temp_tree = bottom_up_tree(&mut long_lived_arena, -i, depth);
78+
temp_tree = bottom_up_tree(&long_lived_arena, -i, depth);
8379
chk += item_check(temp_tree);
8480
i += 1;
8581
}

0 commit comments

Comments
 (0)