bench: Add hard mode to benchmarks. Activate with RUST_BENCH.
RUST_BENCH is on automatically when running `make perf`
This commit is contained in:
parent
2f3cff2806
commit
4fec4cd8f5
|
@ -58,6 +58,14 @@ else
|
|||
CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
|
||||
endif
|
||||
|
||||
# If we're running perf then set this environment variable
|
||||
# to put the benchmarks into 'hard mode'
|
||||
ifeq ($(MAKECMDGOALS),perf)
|
||||
RUST_BENCH=1
|
||||
export RUST_BENCH
|
||||
endif
|
||||
|
||||
|
||||
######################################################################
|
||||
# Main test targets
|
||||
######################################################################
|
||||
|
|
|
@ -21,7 +21,13 @@ fn collect_dvec(num: uint) -> [mut uint] {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let args = if vec::len(args) <= 1u {["", "100000"]} else {args};
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "10000000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "100000"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
let max = uint::from_str(args[1]).get();
|
||||
let start = std::time::precise_time_s();
|
||||
let raw_v = collect_raw(max);
|
||||
|
|
|
@ -404,9 +404,17 @@ fn validate(edges: [(node_id, node_id)],
|
|||
true
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let scale = 10u;
|
||||
let num_keys = 16u;
|
||||
fn main(args: [str]) {
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "12", "48"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "10", "16"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
||||
let scale = uint::from_str(args[1]).get();
|
||||
let num_keys = uint::from_str(args[2]).get();
|
||||
let do_validate = false;
|
||||
let do_sequential = true;
|
||||
|
||||
|
|
|
@ -59,8 +59,15 @@ fn run(args: [str]) {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let args1 = if vec::len(args) <= 1u { ["", "10000", "4"] } else { args };
|
||||
#debug("%?", args1);
|
||||
run(args1);
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "1000000", "10000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "10000", "4"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
||||
#debug("%?", args);
|
||||
run(args);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@ fn ack(m: int, n: int) -> int {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = if vec::len(args) == 2u {
|
||||
option::get(int::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "12"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "8"]
|
||||
} else {
|
||||
8
|
||||
args
|
||||
};
|
||||
let n = int::from_str(args[1]).get();
|
||||
io::println(#fmt("Ack(3,%d): %d\n", n, ack(3, n)));
|
||||
}
|
||||
|
|
|
@ -23,11 +23,15 @@ fn bottom_up_tree(arena: &a.arena::arena, item: int, depth: int) -> &a.tree {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = if vec::len(args) == 2u {
|
||||
option::get(int::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "15"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "8"]
|
||||
} else {
|
||||
8
|
||||
args
|
||||
};
|
||||
|
||||
let n = int::from_str(args[1]).get();
|
||||
let min_depth = 4;
|
||||
let mut max_depth;
|
||||
if min_depth + 2 > n {
|
||||
|
|
|
@ -59,10 +59,14 @@ fn fannkuch(n: int) -> int {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = if vec::len(args) == 2u {
|
||||
option::get(int::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "10"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "8"]
|
||||
} else {
|
||||
8
|
||||
args
|
||||
};
|
||||
|
||||
let n = int::from_str(args[1]).get();
|
||||
io::println(#fmt("Pfannkuchen(%d) = %d", n, fannkuch(n)));
|
||||
}
|
||||
|
|
|
@ -73,7 +73,17 @@ fn make_repeat_fasta(id: str, desc: str, s: str, n: int) unsafe {
|
|||
|
||||
fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; }
|
||||
|
||||
fn main() {
|
||||
fn main(args: [str]) {
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "300000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "1000"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
||||
let n = int::from_str(args[1]).get();
|
||||
|
||||
let iub: [aminoacids] =
|
||||
make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32),
|
||||
acid('t', 27u32), acid('B', 2u32), acid('D', 2u32),
|
||||
|
@ -91,7 +101,6 @@ fn main() {
|
|||
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
|
||||
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
|
||||
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
|
||||
let n: int = 512;
|
||||
make_repeat_fasta("ONE", "Homo sapiens alu", alu, n * 2);
|
||||
make_random_fasta("TWO", "IUB ambiguity codes", iub, n * 3);
|
||||
make_random_fasta("THREE", "Homo sapiens frequency", homosapiens, n * 5);
|
||||
|
|
|
@ -9,10 +9,13 @@ fn fib(n: int) -> int {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = if vec::len(args) == 2u {
|
||||
option::get(int::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "40"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "30"]
|
||||
} else {
|
||||
30
|
||||
args
|
||||
};
|
||||
let n = int::from_str(args[1]).get();
|
||||
io::println(#fmt("%d\n", fib(n)));
|
||||
}
|
||||
|
|
|
@ -140,13 +140,21 @@ fn writer(path: str, writech: comm::chan<comm::chan<line>>, size: uint)
|
|||
}
|
||||
}
|
||||
|
||||
fn main(argv: [str]) {
|
||||
let size = if vec::len(argv) < 2_u { 80u }
|
||||
else { option::get(uint::from_str(argv[1])) };
|
||||
let yieldevery = if vec::len(argv) < 3_u { 10_u }
|
||||
else { option::get(uint::from_str(argv[2])) };
|
||||
let path = if vec::len(argv) < 4_u { "" }
|
||||
else { argv[3] };
|
||||
fn main(args: [str]) {
|
||||
let path = if vec::len(args) < 4_u { "" }
|
||||
else { args[3] };
|
||||
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "4000", "10"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "80", "10"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
||||
let size = uint::from_str(args[1]).get();
|
||||
let yieldevery = uint::from_str(args[2]).get();
|
||||
|
||||
let writep = comm::port();
|
||||
let writech = comm::chan(writep);
|
||||
task::spawn {||
|
||||
|
|
|
@ -14,11 +14,14 @@ native mod libc {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = if vec::len(args) == 2u {
|
||||
option::get(int::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "4000000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "100000"]
|
||||
} else {
|
||||
100000
|
||||
args
|
||||
};
|
||||
let n = int::from_str(args[1]).get();
|
||||
let bodies: [Body::props] = NBodySystem::MakeNBodySystem();
|
||||
io::println(#fmt("%f", NBodySystem::energy(bodies)));
|
||||
let mut i: int = 0;
|
||||
|
|
|
@ -78,19 +78,21 @@ fn stress(num_tasks: int) {
|
|||
for results.each {|r| future::get(r); }
|
||||
}
|
||||
|
||||
fn main(argv: [str]) {
|
||||
if vec::len(argv) == 1u {
|
||||
assert (fib(8) == 21);
|
||||
log(debug, fib(8));
|
||||
fn main(args: [str]) {
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "20"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "8"]
|
||||
} else {
|
||||
// Interactive mode! Wooo!!!!
|
||||
let opts = parse_opts(argv);
|
||||
args
|
||||
};
|
||||
|
||||
let opts = parse_opts(args);
|
||||
|
||||
if opts.stress {
|
||||
stress(2);
|
||||
} else {
|
||||
let max = option::get(uint::parse_buf(str::bytes(argv[1]),
|
||||
let max = option::get(uint::parse_buf(str::bytes(args[1]),
|
||||
10u)) as int;
|
||||
|
||||
let num_trials = 10;
|
||||
|
@ -111,4 +113,3 @@ fn main(argv: [str]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,13 +41,16 @@ fn eval_AtA_times_u(u: [const float], AtAu: [mut float]) {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
|
||||
let N = if vec::len(args) == 2u {
|
||||
option::get(uint::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "2000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "1000"]
|
||||
} else {
|
||||
1000u
|
||||
args
|
||||
};
|
||||
|
||||
let N = uint::from_str(args[1]).get();
|
||||
|
||||
let u = vec::to_mut(vec::from_elem(N, 1.0));
|
||||
let v = vec::to_mut(vec::from_elem(N, 0.0));
|
||||
let mut i = 0u;
|
||||
|
|
|
@ -38,8 +38,15 @@ fn roundtrip(id: int, p: comm::port<int>, ch: comm::chan<int>) {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let token = if vec::len(args) < 2u { 1000 }
|
||||
else { option::get(int::from_str(args[1])) };
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "100000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "1000"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
||||
let token = int::from_str(args[1]).get();
|
||||
|
||||
start(token);
|
||||
}
|
|
@ -18,7 +18,13 @@ fn check_sequential(min: uint, max: uint, map: smallintmap<uint>) {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let args = if vec::len(args) <= 1u {["", "10000", "50"]} else {args};
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "100000", "50"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "10000", "50"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
let max = uint::from_str(args[1]).get();
|
||||
let rep = uint::from_str(args[2]).get();
|
||||
|
||||
|
|
|
@ -46,11 +46,15 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let children = if vec::len(args) == 2u {
|
||||
option::get(uint::from_str(args[1]))
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "100000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "100"]
|
||||
} else {
|
||||
100u
|
||||
args
|
||||
};
|
||||
|
||||
let children = uint::from_str(args[1]).get();
|
||||
let port = comm::port();
|
||||
let chan = comm::chan(port);
|
||||
task::spawn {||
|
||||
|
|
|
@ -9,10 +9,14 @@ fn f(&&n: uint) {
|
|||
fn g() { }
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n =
|
||||
if vec::len(args) < 2u {
|
||||
10u
|
||||
} else { option::get(uint::parse_buf(str::bytes(args[1]), 10u)) };
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "400"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "10"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
let n = uint::from_str(args[1]).get();
|
||||
let mut i = 0u;
|
||||
while i < n { task::spawn {|| f(n); }; i += 1u; }
|
||||
}
|
||||
|
|
|
@ -11,7 +11,13 @@ fn f(&&n: uint) {
|
|||
}
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = if vec::len(args) < 2u { 100u }
|
||||
else { option::get(uint::from_str(args[1])) };
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
["", "50000"]
|
||||
} else if args.len() <= 1u {
|
||||
["", "100"]
|
||||
} else {
|
||||
args
|
||||
};
|
||||
let n = uint::from_str(args[1]).get();
|
||||
uint::range(0u, 100u) {|i| task::spawn {|| f(n); };}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue