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))
|
CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
|
||||||
endif
|
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
|
# Main test targets
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -21,7 +21,13 @@ fn collect_dvec(num: uint) -> [mut uint] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
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 max = uint::from_str(args[1]).get();
|
||||||
let start = std::time::precise_time_s();
|
let start = std::time::precise_time_s();
|
||||||
let raw_v = collect_raw(max);
|
let raw_v = collect_raw(max);
|
||||||
|
@ -404,9 +404,17 @@ fn validate(edges: [(node_id, node_id)],
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main(args: [str]) {
|
||||||
let scale = 10u;
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
let num_keys = 16u;
|
["", "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_validate = false;
|
||||||
let do_sequential = true;
|
let do_sequential = true;
|
||||||
|
|
||||||
|
@ -59,8 +59,15 @@ fn run(args: [str]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let args1 = if vec::len(args) <= 1u { ["", "10000", "4"] } else { args };
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
#debug("%?", args1);
|
["", "1000000", "10000"]
|
||||||
run(args1);
|
} 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]) {
|
fn main(args: [str]) {
|
||||||
let n = if vec::len(args) == 2u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
option::get(int::from_str(args[1]))
|
["", "12"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "8"]
|
||||||
} else {
|
} else {
|
||||||
8
|
args
|
||||||
};
|
};
|
||||||
|
let n = int::from_str(args[1]).get();
|
||||||
io::println(#fmt("Ack(3,%d): %d\n", n, ack(3, n)));
|
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]) {
|
fn main(args: [str]) {
|
||||||
let n = if vec::len(args) == 2u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
option::get(int::from_str(args[1]))
|
["", "15"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "8"]
|
||||||
} else {
|
} else {
|
||||||
8
|
args
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let n = int::from_str(args[1]).get();
|
||||||
let min_depth = 4;
|
let min_depth = 4;
|
||||||
let mut max_depth;
|
let mut max_depth;
|
||||||
if min_depth + 2 > n {
|
if min_depth + 2 > n {
|
||||||
|
@ -59,10 +59,14 @@ fn fannkuch(n: int) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let n = if vec::len(args) == 2u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
option::get(int::from_str(args[1]))
|
["", "10"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "8"]
|
||||||
} else {
|
} else {
|
||||||
8
|
args
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let n = int::from_str(args[1]).get();
|
||||||
io::println(#fmt("Pfannkuchen(%d) = %d", n, fannkuch(n)));
|
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 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] =
|
let iub: [aminoacids] =
|
||||||
make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32),
|
make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32),
|
||||||
acid('t', 27u32), acid('B', 2u32), acid('D', 2u32),
|
acid('t', 27u32), acid('B', 2u32), acid('D', 2u32),
|
||||||
@ -91,7 +101,6 @@ fn main() {
|
|||||||
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
|
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
|
||||||
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
|
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
|
||||||
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
|
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
|
||||||
let n: int = 512;
|
|
||||||
make_repeat_fasta("ONE", "Homo sapiens alu", alu, n * 2);
|
make_repeat_fasta("ONE", "Homo sapiens alu", alu, n * 2);
|
||||||
make_random_fasta("TWO", "IUB ambiguity codes", iub, n * 3);
|
make_random_fasta("TWO", "IUB ambiguity codes", iub, n * 3);
|
||||||
make_random_fasta("THREE", "Homo sapiens frequency", homosapiens, n * 5);
|
make_random_fasta("THREE", "Homo sapiens frequency", homosapiens, n * 5);
|
||||||
|
@ -9,10 +9,13 @@ fn fib(n: int) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let n = if vec::len(args) == 2u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
option::get(int::from_str(args[1]))
|
["", "40"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "30"]
|
||||||
} else {
|
} else {
|
||||||
30
|
args
|
||||||
};
|
};
|
||||||
|
let n = int::from_str(args[1]).get();
|
||||||
io::println(#fmt("%d\n", fib(n)));
|
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]) {
|
fn main(args: [str]) {
|
||||||
let size = if vec::len(argv) < 2_u { 80u }
|
let path = if vec::len(args) < 4_u { "" }
|
||||||
else { option::get(uint::from_str(argv[1])) };
|
else { args[3] };
|
||||||
let yieldevery = if vec::len(argv) < 3_u { 10_u }
|
|
||||||
else { option::get(uint::from_str(argv[2])) };
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
let path = if vec::len(argv) < 4_u { "" }
|
["", "4000", "10"]
|
||||||
else { argv[3] };
|
} 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 writep = comm::port();
|
||||||
let writech = comm::chan(writep);
|
let writech = comm::chan(writep);
|
||||||
task::spawn {||
|
task::spawn {||
|
||||||
|
@ -14,11 +14,14 @@ native mod libc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let n = if vec::len(args) == 2u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
option::get(int::from_str(args[1]))
|
["", "4000000"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "100000"]
|
||||||
} else {
|
} else {
|
||||||
100000
|
args
|
||||||
};
|
};
|
||||||
|
let n = int::from_str(args[1]).get();
|
||||||
let bodies: [Body::props] = NBodySystem::MakeNBodySystem();
|
let bodies: [Body::props] = NBodySystem::MakeNBodySystem();
|
||||||
io::println(#fmt("%f", NBodySystem::energy(bodies)));
|
io::println(#fmt("%f", NBodySystem::energy(bodies)));
|
||||||
let mut i: int = 0;
|
let mut i: int = 0;
|
||||||
|
@ -78,36 +78,37 @@ fn stress(num_tasks: int) {
|
|||||||
for results.each {|r| future::get(r); }
|
for results.each {|r| future::get(r); }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(argv: [str]) {
|
fn main(args: [str]) {
|
||||||
if vec::len(argv) == 1u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
assert (fib(8) == 21);
|
["", "20"]
|
||||||
log(debug, fib(8));
|
} else if args.len() <= 1u {
|
||||||
|
["", "8"]
|
||||||
} else {
|
} else {
|
||||||
// Interactive mode! Wooo!!!!
|
args
|
||||||
let opts = parse_opts(argv);
|
};
|
||||||
|
|
||||||
|
let opts = parse_opts(args);
|
||||||
|
|
||||||
if opts.stress {
|
if opts.stress {
|
||||||
stress(2);
|
stress(2);
|
||||||
} else {
|
} 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;
|
10u)) as int;
|
||||||
|
|
||||||
let num_trials = 10;
|
let num_trials = 10;
|
||||||
|
|
||||||
let out = io::stdout();
|
let out = io::stdout();
|
||||||
|
|
||||||
range(1, max + 1) {|n|
|
range(1, max + 1) {|n|
|
||||||
range(0, num_trials) {|i|
|
range(0, num_trials) {|i|
|
||||||
let start = time::precise_time_ns();
|
let start = time::precise_time_ns();
|
||||||
let fibn = fib(n);
|
let fibn = fib(n);
|
||||||
let stop = time::precise_time_ns();
|
let stop = time::precise_time_ns();
|
||||||
|
|
||||||
let elapsed = stop - start;
|
let elapsed = stop - start;
|
||||||
|
|
||||||
out.write_line(#fmt["%d\t%d\t%s", n, fibn,
|
out.write_line(#fmt["%d\t%d\t%s", n, fibn,
|
||||||
u64::str(elapsed)]);
|
u64::str(elapsed)]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,13 +41,16 @@ fn eval_AtA_times_u(u: [const float], AtAu: [mut float]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
let N = if vec::len(args) == 2u {
|
["", "2000"]
|
||||||
option::get(uint::from_str(args[1]))
|
} else if args.len() <= 1u {
|
||||||
|
["", "1000"]
|
||||||
} else {
|
} else {
|
||||||
1000u
|
args
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let N = uint::from_str(args[1]).get();
|
||||||
|
|
||||||
let u = vec::to_mut(vec::from_elem(N, 1.0));
|
let u = vec::to_mut(vec::from_elem(N, 1.0));
|
||||||
let v = vec::to_mut(vec::from_elem(N, 0.0));
|
let v = vec::to_mut(vec::from_elem(N, 0.0));
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
|
@ -38,8 +38,15 @@ fn roundtrip(id: int, p: comm::port<int>, ch: comm::chan<int>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let token = if vec::len(args) < 2u { 1000 }
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
else { option::get(int::from_str(args[1])) };
|
["", "100000"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "1000"]
|
||||||
|
} else {
|
||||||
|
args
|
||||||
|
};
|
||||||
|
|
||||||
|
let token = int::from_str(args[1]).get();
|
||||||
|
|
||||||
start(token);
|
start(token);
|
||||||
}
|
}
|
@ -18,7 +18,13 @@ fn check_sequential(min: uint, max: uint, map: smallintmap<uint>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
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 max = uint::from_str(args[1]).get();
|
||||||
let rep = uint::from_str(args[2]).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]) {
|
fn main(args: [str]) {
|
||||||
let children = if vec::len(args) == 2u {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
option::get(uint::from_str(args[1]))
|
["", "100000"]
|
||||||
|
} else if args.len() <= 1u {
|
||||||
|
["", "100"]
|
||||||
} else {
|
} else {
|
||||||
100u
|
args
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let children = uint::from_str(args[1]).get();
|
||||||
let port = comm::port();
|
let port = comm::port();
|
||||||
let chan = comm::chan(port);
|
let chan = comm::chan(port);
|
||||||
task::spawn {||
|
task::spawn {||
|
||||||
|
@ -9,10 +9,14 @@ fn f(&&n: uint) {
|
|||||||
fn g() { }
|
fn g() { }
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let n =
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
if vec::len(args) < 2u {
|
["", "400"]
|
||||||
10u
|
} else if args.len() <= 1u {
|
||||||
} else { option::get(uint::parse_buf(str::bytes(args[1]), 10u)) };
|
["", "10"]
|
||||||
|
} else {
|
||||||
|
args
|
||||||
|
};
|
||||||
|
let n = uint::from_str(args[1]).get();
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
while i < n { task::spawn {|| f(n); }; i += 1u; }
|
while i < n { task::spawn {|| f(n); }; i += 1u; }
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,13 @@ fn f(&&n: uint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]) {
|
fn main(args: [str]) {
|
||||||
let n = if vec::len(args) < 2u { 100u }
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
else { option::get(uint::from_str(args[1])) };
|
["", "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); };}
|
uint::range(0u, 100u) {|i| task::spawn {|| f(n); };}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user