Skip to content

Commit 800a081

Browse files
committed
---
yaml --- r: 16016 b: refs/heads/try c: 4fec4cd h: refs/heads/master v: v3
1 parent b4e18c3 commit 800a081

19 files changed

+164
-70
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 2f3cff28067000c46c44ed05400786bb400e937c
5+
refs/heads/try: 4fec4cd8f5ad45e8caea324df7434a82e560ca38
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/mk/tests.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ else
5858
CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
5959
endif
6060

61+
# If we're running perf then set this environment variable
62+
# to put the benchmarks into 'hard mode'
63+
ifeq ($(MAKECMDGOALS),perf)
64+
RUST_BENCH=1
65+
export RUST_BENCH
66+
endif
67+
68+
6169
######################################################################
6270
# Main test targets
6371
######################################################################

branches/try/src/test/bench/core-vec-append.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ fn collect_dvec(num: uint) -> [mut uint] {
2121
}
2222

2323
fn main(args: [str]) {
24-
let args = if vec::len(args) <= 1u {["", "100000"]} else {args};
24+
let args = if os::getenv("RUST_BENCH").is_some() {
25+
["", "10000000"]
26+
} else if args.len() <= 1u {
27+
["", "100000"]
28+
} else {
29+
args
30+
};
2531
let max = uint::from_str(args[1]).get();
2632
let start = std::time::precise_time_s();
2733
let raw_v = collect_raw(max);

branches/try/src/test/bench/graph500-bfs.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,17 @@ fn validate(edges: [(node_id, node_id)],
404404
true
405405
}
406406

407-
fn main() {
408-
let scale = 10u;
409-
let num_keys = 16u;
407+
fn main(args: [str]) {
408+
let args = if os::getenv("RUST_BENCH").is_some() {
409+
["", "12", "48"]
410+
} else if args.len() <= 1u {
411+
["", "10", "16"]
412+
} else {
413+
args
414+
};
415+
416+
let scale = uint::from_str(args[1]).get();
417+
let num_keys = uint::from_str(args[2]).get();
410418
let do_validate = false;
411419
let do_sequential = true;
412420

branches/try/src/test/bench/msgsend.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,15 @@ fn run(args: [str]) {
5959
}
6060

6161
fn main(args: [str]) {
62-
let args1 = if vec::len(args) <= 1u { ["", "10000", "4"] } else { args };
63-
#debug("%?", args1);
64-
run(args1);
62+
let args = if os::getenv("RUST_BENCH").is_some() {
63+
["", "1000000", "10000"]
64+
} else if args.len() <= 1u {
65+
["", "10000", "4"]
66+
} else {
67+
args
68+
};
69+
70+
#debug("%?", args);
71+
run(args);
6572
}
6673

branches/try/src/test/bench/shootout-ackermann.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ fn ack(m: int, n: int) -> int {
1313
}
1414

1515
fn main(args: [str]) {
16-
let n = if vec::len(args) == 2u {
17-
option::get(int::from_str(args[1]))
16+
let args = if os::getenv("RUST_BENCH").is_some() {
17+
["", "12"]
18+
} else if args.len() <= 1u {
19+
["", "8"]
1820
} else {
19-
8
21+
args
2022
};
23+
let n = int::from_str(args[1]).get();
2124
io::println(#fmt("Ack(3,%d): %d\n", n, ack(3, n)));
2225
}

branches/try/src/test/bench/shootout-binarytrees.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ fn bottom_up_tree(arena: &a.arena::arena, item: int, depth: int) -> &a.tree {
2323
}
2424

2525
fn main(args: [str]) {
26-
let n = if vec::len(args) == 2u {
27-
option::get(int::from_str(args[1]))
26+
let args = if os::getenv("RUST_BENCH").is_some() {
27+
["", "15"]
28+
} else if args.len() <= 1u {
29+
["", "8"]
2830
} else {
29-
8
31+
args
3032
};
33+
34+
let n = int::from_str(args[1]).get();
3135
let min_depth = 4;
3236
let mut max_depth;
3337
if min_depth + 2 > n {

branches/try/src/test/bench/shootout-fannkuchredux.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ fn fannkuch(n: int) -> int {
5959
}
6060

6161
fn main(args: [str]) {
62-
let n = if vec::len(args) == 2u {
63-
option::get(int::from_str(args[1]))
62+
let args = if os::getenv("RUST_BENCH").is_some() {
63+
["", "10"]
64+
} else if args.len() <= 1u {
65+
["", "8"]
6466
} else {
65-
8
67+
args
6668
};
69+
70+
let n = int::from_str(args[1]).get();
6771
io::println(#fmt("Pfannkuchen(%d) = %d", n, fannkuch(n)));
6872
}

branches/try/src/test/bench/shootout-fasta.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,17 @@ fn make_repeat_fasta(id: str, desc: str, s: str, n: int) unsafe {
7373

7474
fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; }
7575

76-
fn main() {
76+
fn main(args: [str]) {
77+
let args = if os::getenv("RUST_BENCH").is_some() {
78+
["", "300000"]
79+
} else if args.len() <= 1u {
80+
["", "1000"]
81+
} else {
82+
args
83+
};
84+
85+
let n = int::from_str(args[1]).get();
86+
7787
let iub: [aminoacids] =
7888
make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32),
7989
acid('t', 27u32), acid('B', 2u32), acid('D', 2u32),
@@ -91,7 +101,6 @@ fn main() {
91101
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
92102
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
93103
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
94-
let n: int = 512;
95104
make_repeat_fasta("ONE", "Homo sapiens alu", alu, n * 2);
96105
make_random_fasta("TWO", "IUB ambiguity codes", iub, n * 3);
97106
make_random_fasta("THREE", "Homo sapiens frequency", homosapiens, n * 5);

branches/try/src/test/bench/shootout-fibo.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ fn fib(n: int) -> int {
99
}
1010

1111
fn main(args: [str]) {
12-
let n = if vec::len(args) == 2u {
13-
option::get(int::from_str(args[1]))
12+
let args = if os::getenv("RUST_BENCH").is_some() {
13+
["", "40"]
14+
} else if args.len() <= 1u {
15+
["", "30"]
1416
} else {
15-
30
17+
args
1618
};
19+
let n = int::from_str(args[1]).get();
1720
io::println(#fmt("%d\n", fib(n)));
1821
}

branches/try/src/test/bench/shootout-mandelbrot.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,21 @@ fn writer(path: str, writech: comm::chan<comm::chan<line>>, size: uint)
140140
}
141141
}
142142

143-
fn main(argv: [str]) {
144-
let size = if vec::len(argv) < 2_u { 80u }
145-
else { option::get(uint::from_str(argv[1])) };
146-
let yieldevery = if vec::len(argv) < 3_u { 10_u }
147-
else { option::get(uint::from_str(argv[2])) };
148-
let path = if vec::len(argv) < 4_u { "" }
149-
else { argv[3] };
143+
fn main(args: [str]) {
144+
let path = if vec::len(args) < 4_u { "" }
145+
else { args[3] };
146+
147+
let args = if os::getenv("RUST_BENCH").is_some() {
148+
["", "4000", "10"]
149+
} else if args.len() <= 1u {
150+
["", "80", "10"]
151+
} else {
152+
args
153+
};
154+
155+
let size = uint::from_str(args[1]).get();
156+
let yieldevery = uint::from_str(args[2]).get();
157+
150158
let writep = comm::port();
151159
let writech = comm::chan(writep);
152160
task::spawn {||

branches/try/src/test/bench/shootout-nbody.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ native mod libc {
1414
}
1515

1616
fn main(args: [str]) {
17-
let n = if vec::len(args) == 2u {
18-
option::get(int::from_str(args[1]))
17+
let args = if os::getenv("RUST_BENCH").is_some() {
18+
["", "4000000"]
19+
} else if args.len() <= 1u {
20+
["", "100000"]
1921
} else {
20-
100000
22+
args
2123
};
24+
let n = int::from_str(args[1]).get();
2225
let bodies: [Body::props] = NBodySystem::MakeNBodySystem();
2326
io::println(#fmt("%f", NBodySystem::energy(bodies)));
2427
let mut i: int = 0;

branches/try/src/test/bench/shootout-pfib.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,36 +78,37 @@ fn stress(num_tasks: int) {
7878
for results.each {|r| future::get(r); }
7979
}
8080

81-
fn main(argv: [str]) {
82-
if vec::len(argv) == 1u {
83-
assert (fib(8) == 21);
84-
log(debug, fib(8));
81+
fn main(args: [str]) {
82+
let args = if os::getenv("RUST_BENCH").is_some() {
83+
["", "20"]
84+
} else if args.len() <= 1u {
85+
["", "8"]
8586
} else {
86-
// Interactive mode! Wooo!!!!
87-
let opts = parse_opts(argv);
87+
args
88+
};
8889

90+
let opts = parse_opts(args);
8991

90-
if opts.stress {
91-
stress(2);
92-
} else {
93-
let max = option::get(uint::parse_buf(str::bytes(argv[1]),
94-
10u)) as int;
92+
if opts.stress {
93+
stress(2);
94+
} else {
95+
let max = option::get(uint::parse_buf(str::bytes(args[1]),
96+
10u)) as int;
9597

96-
let num_trials = 10;
98+
let num_trials = 10;
9799

98-
let out = io::stdout();
100+
let out = io::stdout();
99101

100-
range(1, max + 1) {|n|
101-
range(0, num_trials) {|i|
102-
let start = time::precise_time_ns();
103-
let fibn = fib(n);
104-
let stop = time::precise_time_ns();
102+
range(1, max + 1) {|n|
103+
range(0, num_trials) {|i|
104+
let start = time::precise_time_ns();
105+
let fibn = fib(n);
106+
let stop = time::precise_time_ns();
105107

106-
let elapsed = stop - start;
108+
let elapsed = stop - start;
107109

108-
out.write_line(#fmt["%d\t%d\t%s", n, fibn,
109-
u64::str(elapsed)]);
110-
}
110+
out.write_line(#fmt["%d\t%d\t%s", n, fibn,
111+
u64::str(elapsed)]);
111112
}
112113
}
113114
}

branches/try/src/test/bench/shootout-spectralnorm.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@ fn eval_AtA_times_u(u: [const float], AtAu: [mut float]) {
4141
}
4242

4343
fn main(args: [str]) {
44-
45-
let N = if vec::len(args) == 2u {
46-
option::get(uint::from_str(args[1]))
44+
let args = if os::getenv("RUST_BENCH").is_some() {
45+
["", "2000"]
46+
} else if args.len() <= 1u {
47+
["", "1000"]
4748
} else {
48-
1000u
49+
args
4950
};
5051

52+
let N = uint::from_str(args[1]).get();
53+
5154
let u = vec::to_mut(vec::from_elem(N, 1.0));
5255
let v = vec::to_mut(vec::from_elem(N, 0.0));
5356
let mut i = 0u;

branches/try/src/test/bench/shootout-threadring.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,15 @@ fn roundtrip(id: int, p: comm::port<int>, ch: comm::chan<int>) {
3838
}
3939

4040
fn main(args: [str]) {
41-
let token = if vec::len(args) < 2u { 1000 }
42-
else { option::get(int::from_str(args[1])) };
41+
let args = if os::getenv("RUST_BENCH").is_some() {
42+
["", "100000"]
43+
} else if args.len() <= 1u {
44+
["", "1000"]
45+
} else {
46+
args
47+
};
48+
49+
let token = int::from_str(args[1]).get();
4350

4451
start(token);
4552
}

branches/try/src/test/bench/std-smallintmap.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ fn check_sequential(min: uint, max: uint, map: smallintmap<uint>) {
1818
}
1919

2020
fn main(args: [str]) {
21-
let args = if vec::len(args) <= 1u {["", "10000", "50"]} else {args};
21+
let args = if os::getenv("RUST_BENCH").is_some() {
22+
["", "100000", "50"]
23+
} else if args.len() <= 1u {
24+
["", "10000", "50"]
25+
} else {
26+
args
27+
};
2228
let max = uint::from_str(args[1]).get();
2329
let rep = uint::from_str(args[2]).get();
2430

branches/try/src/test/bench/task-perf-one-million.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) {
4646
}
4747

4848
fn main(args: [str]) {
49-
let children = if vec::len(args) == 2u {
50-
option::get(uint::from_str(args[1]))
49+
let args = if os::getenv("RUST_BENCH").is_some() {
50+
["", "100000"]
51+
} else if args.len() <= 1u {
52+
["", "100"]
5153
} else {
52-
100u
54+
args
5355
};
56+
57+
let children = uint::from_str(args[1]).get();
5458
let port = comm::port();
5559
let chan = comm::chan(port);
5660
task::spawn {||

branches/try/src/test/bench/task-perf-spawnalot.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ fn f(&&n: uint) {
99
fn g() { }
1010

1111
fn main(args: [str]) {
12-
let n =
13-
if vec::len(args) < 2u {
14-
10u
15-
} else { option::get(uint::parse_buf(str::bytes(args[1]), 10u)) };
12+
let args = if os::getenv("RUST_BENCH").is_some() {
13+
["", "400"]
14+
} else if args.len() <= 1u {
15+
["", "10"]
16+
} else {
17+
args
18+
};
19+
let n = uint::from_str(args[1]).get();
1620
let mut i = 0u;
1721
while i < n { task::spawn {|| f(n); }; i += 1u; }
1822
}

branches/try/src/test/bench/task-perf-vector-party.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ fn f(&&n: uint) {
1111
}
1212

1313
fn main(args: [str]) {
14-
let n = if vec::len(args) < 2u { 100u }
15-
else { option::get(uint::from_str(args[1])) };
14+
let args = if os::getenv("RUST_BENCH").is_some() {
15+
["", "50000"]
16+
} else if args.len() <= 1u {
17+
["", "100"]
18+
} else {
19+
args
20+
};
21+
let n = uint::from_str(args[1]).get();
1622
uint::range(0u, 100u) {|i| task::spawn {|| f(n); };}
1723
}

0 commit comments

Comments
 (0)