Fix warnings in src/test/bench tests. Nobody will ever care.
This commit is contained in:
parent
7ad7911222
commit
4bcda7148d
@ -30,7 +30,7 @@ macro_rules! bench (
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let argv = os::args();
|
let argv = os::args();
|
||||||
let tests = argv.slice(1, argv.len());
|
let _tests = argv.slice(1, argv.len());
|
||||||
|
|
||||||
bench!(shift_push);
|
bench!(shift_push);
|
||||||
bench!(read_line);
|
bench!(read_line);
|
||||||
@ -44,7 +44,7 @@ fn main() {
|
|||||||
fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
|
fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
|
||||||
let mut run_test = false;
|
let mut run_test = false;
|
||||||
|
|
||||||
if os::getenv(~"RUST_BENCH").is_some() {
|
if os::getenv("RUST_BENCH").is_some() {
|
||||||
run_test = true
|
run_test = true
|
||||||
} else if argv.len() > 0 {
|
} else if argv.len() > 0 {
|
||||||
run_test = argv.iter().any(|x| x == &~"all") || argv.iter().any(|x| x == &name)
|
run_test = argv.iter().any(|x| x == &~"all") || argv.iter().any(|x| x == &name)
|
||||||
|
@ -13,7 +13,7 @@ use std::uint;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"10000000"]
|
~[~"", ~"10000000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"100000"]
|
~[~"", ~"100000"]
|
||||||
|
@ -410,7 +410,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"15", ~"48"]
|
~[~"", ~"15", ~"48"]
|
||||||
} else if args.len() <= 1 {
|
} else if args.len() <= 1 {
|
||||||
~[~"", ~"10", ~"16"]
|
~[~"", ~"10", ~"16"]
|
||||||
@ -447,7 +447,7 @@ fn main() {
|
|||||||
let graph_arc = arc::ARC(graph.clone());
|
let graph_arc = arc::ARC(graph.clone());
|
||||||
|
|
||||||
do gen_search_keys(graph, num_keys).map() |root| {
|
do gen_search_keys(graph, num_keys).map() |root| {
|
||||||
io::stdout().write_line(~"");
|
io::stdout().write_line("");
|
||||||
io::stdout().write_line(fmt!("Search key: %?", root));
|
io::stdout().write_line(fmt!("Search key: %?", root));
|
||||||
|
|
||||||
if do_sequential {
|
if do_sequential {
|
||||||
@ -511,7 +511,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
io::stdout().write_line(~"");
|
io::stdout().write_line("");
|
||||||
io::stdout().write_line(
|
io::stdout().write_line(
|
||||||
fmt!("Total sequential: %? \t Total Parallel: %? \t Speedup: %?x",
|
fmt!("Total sequential: %? \t Total Parallel: %? \t Speedup: %?x",
|
||||||
total_seq, total_par, total_seq / total_par));
|
total_seq, total_par, total_seq / total_par));
|
||||||
|
@ -22,15 +22,12 @@ extern mod extra;
|
|||||||
|
|
||||||
use std::comm::{Port, Chan, SharedChan};
|
use std::comm::{Port, Chan, SharedChan};
|
||||||
use std::comm;
|
use std::comm;
|
||||||
use std::io::{Writer, WriterUtil};
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::ptr;
|
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
fn move_out<T>(x: T) {}
|
fn move_out<T>(_x: T) {}
|
||||||
|
|
||||||
enum request {
|
enum request {
|
||||||
get_count,
|
get_count,
|
||||||
@ -38,7 +35,7 @@ enum request {
|
|||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
|
|
||||||
fn server(requests: &Port<request>, responses: &comm::Chan<uint>) {
|
fn server(requests: &Port<request>, responses: &Chan<uint>) {
|
||||||
let mut count = 0u;
|
let mut count = 0u;
|
||||||
let mut done = false;
|
let mut done = false;
|
||||||
while !done {
|
while !done {
|
||||||
@ -102,7 +99,7 @@ fn run(args: &[~str]) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"1000000", ~"10000"]
|
~[~"", ~"1000000", ~"10000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10000", ~"4"]
|
~[~"", ~"10000", ~"4"]
|
||||||
|
@ -16,16 +16,13 @@
|
|||||||
|
|
||||||
extern mod extra;
|
extern mod extra;
|
||||||
|
|
||||||
use std::comm::{Port, PortSet, Chan, stream};
|
use std::comm::{PortSet, Chan, stream};
|
||||||
use std::io::{Writer, WriterUtil};
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::ptr;
|
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
fn move_out<T>(x: T) {}
|
fn move_out<T>(_x: T) {}
|
||||||
|
|
||||||
enum request {
|
enum request {
|
||||||
get_count,
|
get_count,
|
||||||
@ -98,7 +95,7 @@ fn run(args: &[~str]) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"1000000", ~"8"]
|
~[~"", ~"1000000", ~"8"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10000", ~"4"]
|
~[~"", ~"10000", ~"4"]
|
||||||
|
@ -24,7 +24,6 @@ use std::cell::Cell;
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
// A poor man's pipe.
|
// A poor man's pipe.
|
||||||
type pipe = arc::MutexARC<~[uint]>;
|
type pipe = arc::MutexARC<~[uint]>;
|
||||||
@ -60,8 +59,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
|||||||
// Send/Receive lots of messages.
|
// Send/Receive lots of messages.
|
||||||
for uint::range(0u, count) |j| {
|
for uint::range(0u, count) |j| {
|
||||||
//error!("task %?, iter %?", i, j);
|
//error!("task %?, iter %?", i, j);
|
||||||
let mut num_chan2 = num_chan.take_unwrap();
|
let num_chan2 = num_chan.take_unwrap();
|
||||||
let mut num_port2 = num_port.take_unwrap();
|
let num_port2 = num_port.take_unwrap();
|
||||||
send(&num_chan2, i * j);
|
send(&num_chan2, i * j);
|
||||||
num_chan = Some(num_chan2);
|
num_chan = Some(num_chan2);
|
||||||
let _n = recv(&num_port2);
|
let _n = recv(&num_port2);
|
||||||
@ -72,7 +71,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"100", ~"10000"]
|
~[~"", ~"100", ~"10000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10", ~"100"]
|
~[~"", ~"10", ~"100"]
|
||||||
@ -84,7 +83,7 @@ fn main() {
|
|||||||
let msg_per_task = uint::from_str(args[2]).get();
|
let msg_per_task = uint::from_str(args[2]).get();
|
||||||
|
|
||||||
let (num_chan, num_port) = init();
|
let (num_chan, num_port) = init();
|
||||||
let mut num_chan = Cell::new(num_chan);
|
let num_chan = Cell::new(num_chan);
|
||||||
|
|
||||||
let start = time::precise_time_s();
|
let start = time::precise_time_s();
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ use std::cell::Cell;
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::pipes::recv;
|
use std::pipes::recv;
|
||||||
use std::ptr;
|
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::util;
|
use std::util;
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ fn thread_ring(i: uint,
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"100", ~"10000"]
|
~[~"", ~"100", ~"10000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"100", ~"1000"]
|
~[~"", ~"100", ~"1000"]
|
||||||
@ -70,7 +69,7 @@ fn main() {
|
|||||||
let msg_per_task = uint::from_str(args[2]).get();
|
let msg_per_task = uint::from_str(args[2]).get();
|
||||||
|
|
||||||
let (num_port, num_chan) = ring::init();
|
let (num_port, num_chan) = ring::init();
|
||||||
let mut num_chan = Cell::new(num_chan);
|
let num_chan = Cell::new(num_chan);
|
||||||
|
|
||||||
let start = time::precise_time_s();
|
let start = time::precise_time_s();
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ use std::cell::Cell;
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
// A poor man's pipe.
|
// A poor man's pipe.
|
||||||
type pipe = arc::RWARC<~[uint]>;
|
type pipe = arc::RWARC<~[uint]>;
|
||||||
@ -56,8 +55,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
|||||||
// Send/Receive lots of messages.
|
// Send/Receive lots of messages.
|
||||||
for uint::range(0u, count) |j| {
|
for uint::range(0u, count) |j| {
|
||||||
//error!("task %?, iter %?", i, j);
|
//error!("task %?, iter %?", i, j);
|
||||||
let mut num_chan2 = num_chan.take_unwrap();
|
let num_chan2 = num_chan.take_unwrap();
|
||||||
let mut num_port2 = num_port.take_unwrap();
|
let num_port2 = num_port.take_unwrap();
|
||||||
send(&num_chan2, i * j);
|
send(&num_chan2, i * j);
|
||||||
num_chan = Some(num_chan2);
|
num_chan = Some(num_chan2);
|
||||||
let _n = recv(&num_port2);
|
let _n = recv(&num_port2);
|
||||||
@ -68,7 +67,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"100", ~"10000"]
|
~[~"", ~"100", ~"10000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10", ~"100"]
|
~[~"", ~"10", ~"100"]
|
||||||
@ -80,7 +79,7 @@ fn main() {
|
|||||||
let msg_per_task = uint::from_str(args[2]).get();
|
let msg_per_task = uint::from_str(args[2]).get();
|
||||||
|
|
||||||
let (num_chan, num_port) = init();
|
let (num_chan, num_port) = init();
|
||||||
let mut num_chan = Cell::new(num_chan);
|
let num_chan = Cell::new(num_chan);
|
||||||
|
|
||||||
let start = time::precise_time_s();
|
let start = time::precise_time_s();
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ fn timeit(f: &fn()) -> float {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let count = if os::getenv(~"RUST_BENCH").is_some() {
|
let count = if os::getenv("RUST_BENCH").is_some() {
|
||||||
250000
|
250000
|
||||||
} else {
|
} else {
|
||||||
100
|
100
|
||||||
|
@ -28,7 +28,7 @@ fn ack(m: int, n: int) -> int {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"12"]
|
~[~"", ~"12"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"8"]
|
~[~"", ~"8"]
|
||||||
|
@ -40,7 +40,7 @@ fn main() {
|
|||||||
use std::os;
|
use std::os;
|
||||||
use std::int;
|
use std::int;
|
||||||
let args = std::os::args();
|
let args = std::os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"17"]
|
~[~"", ~"17"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"8"]
|
~[~"", ~"8"]
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
extern mod extra;
|
extern mod extra;
|
||||||
|
|
||||||
use extra::sort;
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::comm::*;
|
use std::comm::*;
|
||||||
use std::io;
|
use std::io;
|
||||||
@ -20,7 +19,6 @@ use std::option;
|
|||||||
use std::os;
|
use std::os;
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
fn print_complements() {
|
fn print_complements() {
|
||||||
let all = [Blue, Red, Yellow];
|
let all = [Blue, Red, Yellow];
|
||||||
@ -206,7 +204,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"200000"]
|
~[~"", ~"200000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"600"]
|
~[~"", ~"600"]
|
||||||
@ -217,10 +215,10 @@ fn main() {
|
|||||||
let nn = uint::from_str(args[1]).get();
|
let nn = uint::from_str(args[1]).get();
|
||||||
|
|
||||||
print_complements();
|
print_complements();
|
||||||
io::println(~"");
|
io::println("");
|
||||||
|
|
||||||
rendezvous(nn, ~[Blue, Red, Yellow]);
|
rendezvous(nn, ~[Blue, Red, Yellow]);
|
||||||
io::println(~"");
|
io::println("");
|
||||||
|
|
||||||
rendezvous(nn,
|
rendezvous(nn,
|
||||||
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);
|
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);
|
||||||
|
@ -2,7 +2,6 @@ use std::cast::transmute;
|
|||||||
use std::from_str::FromStr;
|
use std::from_str::FromStr;
|
||||||
use std::libc::{FILE, STDOUT_FILENO, c_int, fdopen, fputc, fputs, fwrite, size_t};
|
use std::libc::{FILE, STDOUT_FILENO, c_int, fdopen, fputc, fputs, fwrite, size_t};
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::str;
|
|
||||||
use std::uint::{min, range};
|
use std::uint::{min, range};
|
||||||
use std::vec::bytes::copy_memory;
|
use std::vec::bytes::copy_memory;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
|
@ -24,7 +24,7 @@ fn fib(n: int) -> int {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"40"]
|
~[~"", ~"40"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"30"]
|
~[~"", ~"30"]
|
||||||
|
@ -121,8 +121,8 @@ fn windows_with_carry(bb: &[u8], nn: uint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make_sequence_processor(sz: uint,
|
fn make_sequence_processor(sz: uint,
|
||||||
from_parent: &comm::Port<~[u8]>,
|
from_parent: &Port<~[u8]>,
|
||||||
to_parent: &comm::Chan<~str>) {
|
to_parent: &Chan<~str>) {
|
||||||
let mut freqs: HashMap<~[u8], uint> = HashMap::new();
|
let mut freqs: HashMap<~[u8], uint> = HashMap::new();
|
||||||
let mut carry: ~[u8] = ~[];
|
let mut carry: ~[u8] = ~[];
|
||||||
let mut total: uint = 0u;
|
let mut total: uint = 0u;
|
||||||
@ -143,11 +143,11 @@ fn make_sequence_processor(sz: uint,
|
|||||||
let buffer = match sz {
|
let buffer = match sz {
|
||||||
1u => { sort_and_fmt(&freqs, total) }
|
1u => { sort_and_fmt(&freqs, total) }
|
||||||
2u => { sort_and_fmt(&freqs, total) }
|
2u => { sort_and_fmt(&freqs, total) }
|
||||||
3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), ~"GGT") }
|
3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), "GGT") }
|
||||||
4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), ~"GGTA") }
|
4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), "GGTA") }
|
||||||
6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), ~"GGTATT") }
|
6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), "GGTATT") }
|
||||||
12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT") }
|
12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), "GGTATTTTAATT") }
|
||||||
18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT") }
|
18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), "GGTATTTTAATTTATAGT") }
|
||||||
_ => { ~"" }
|
_ => { ~"" }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -156,8 +156,7 @@ fn make_sequence_processor(sz: uint,
|
|||||||
|
|
||||||
// given a FASTA file on stdin, process sequence THREE
|
// given a FASTA file on stdin, process sequence THREE
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let rdr = if os::getenv("RUST_BENCH").is_some() {
|
||||||
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
|
|
||||||
// FIXME: Using this compile-time env variable is a crummy way to
|
// FIXME: Using this compile-time env variable is a crummy way to
|
||||||
// get to this massive data set, but include_bin! chokes on it (#2598)
|
// get to this massive data set, but include_bin! chokes on it (#2598)
|
||||||
let path = Path(env!("CFG_SRC_DIR"))
|
let path = Path(env!("CFG_SRC_DIR"))
|
||||||
@ -203,7 +202,7 @@ fn main() {
|
|||||||
|
|
||||||
// start processing if this is the one
|
// start processing if this is the one
|
||||||
('>', false) => {
|
('>', false) => {
|
||||||
match line.slice_from(1).find_str(~"THREE") {
|
match line.slice_from(1).find_str("THREE") {
|
||||||
option::Some(_) => { proc_mode = true; }
|
option::Some(_) => { proc_mode = true; }
|
||||||
option::None => { }
|
option::None => { }
|
||||||
}
|
}
|
||||||
@ -217,7 +216,7 @@ fn main() {
|
|||||||
let line_bytes = line.as_bytes();
|
let line_bytes = line.as_bytes();
|
||||||
|
|
||||||
for sizes.iter().enumerate().advance |(ii, _sz)| {
|
for sizes.iter().enumerate().advance |(ii, _sz)| {
|
||||||
let mut lb = line_bytes.to_owned();
|
let lb = line_bytes.to_owned();
|
||||||
to_child[ii].send(lb);
|
to_child[ii].send(lb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::from_str::FromStr;
|
use std::from_str::FromStr;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::uint::range;
|
use std::uint::range;
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
static PI: f64 = 3.141592653589793;
|
static PI: f64 = 3.141592653589793;
|
||||||
static SOLAR_MASS: f64 = 4.0 * PI * PI;
|
static SOLAR_MASS: f64 = 4.0 * PI * PI;
|
||||||
|
@ -28,7 +28,6 @@ use std::io::WriterUtil;
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::result::{Ok, Err};
|
use std::result::{Ok, Err};
|
||||||
use std::str;
|
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::u64;
|
use std::u64;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
@ -59,13 +58,13 @@ struct Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn parse_opts(argv: ~[~str]) -> Config {
|
fn parse_opts(argv: ~[~str]) -> Config {
|
||||||
let opts = ~[getopts::optflag(~"stress")];
|
let opts = ~[getopts::optflag("stress")];
|
||||||
|
|
||||||
let opt_args = argv.slice(1, argv.len());
|
let opt_args = argv.slice(1, argv.len());
|
||||||
|
|
||||||
match getopts::getopts(opt_args, opts) {
|
match getopts::getopts(opt_args, opts) {
|
||||||
Ok(ref m) => {
|
Ok(ref m) => {
|
||||||
return Config {stress: getopts::opt_present(m, ~"stress")}
|
return Config {stress: getopts::opt_present(m, "stress")}
|
||||||
}
|
}
|
||||||
Err(_) => { fail!(); }
|
Err(_) => { fail!(); }
|
||||||
}
|
}
|
||||||
@ -97,7 +96,7 @@ fn stress(num_tasks: int) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"20"]
|
~[~"", ~"20"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"8"]
|
~[~"", ~"8"]
|
||||||
|
@ -5,7 +5,6 @@ use std::cast::transmute;
|
|||||||
use std::libc::{STDOUT_FILENO, c_int, fdopen, fgets, fopen, fputc, fwrite};
|
use std::libc::{STDOUT_FILENO, c_int, fdopen, fgets, fopen, fputc, fwrite};
|
||||||
use std::libc::{size_t};
|
use std::libc::{size_t};
|
||||||
use std::ptr::null;
|
use std::ptr::null;
|
||||||
use std::vec::raw::set_len;
|
|
||||||
|
|
||||||
static LINE_LEN: u32 = 80;
|
static LINE_LEN: u32 = 80;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ use std::os;
|
|||||||
fn start(n_tasks: int, token: int) {
|
fn start(n_tasks: int, token: int) {
|
||||||
let (p, ch1) = stream();
|
let (p, ch1) = stream();
|
||||||
let mut p = p;
|
let mut p = p;
|
||||||
let mut ch1 = ch1;
|
let ch1 = ch1;
|
||||||
ch1.send(token);
|
ch1.send(token);
|
||||||
// XXX could not get this to work with a range closure
|
// XXX could not get this to work with a range closure
|
||||||
let mut i = 2;
|
let mut i = 2;
|
||||||
@ -55,7 +55,7 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"2000000", ~"503"]
|
~[~"", ~"2000000", ~"503"]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -32,7 +32,7 @@ fn check_sequential(min: uint, max: uint, map: &SmallIntMap<uint>) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"100000", ~"100"]
|
~[~"", ~"100000", ~"100"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10000", ~"50"]
|
~[~"", ~"10000", ~"50"]
|
||||||
|
@ -15,7 +15,6 @@ extern mod extra;
|
|||||||
use std::io::{ReaderUtil, WriterUtil};
|
use std::io::{ReaderUtil, WriterUtil};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::str;
|
|
||||||
use std::u8;
|
use std::u8;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::unstable::intrinsics::cttz16;
|
use std::unstable::intrinsics::cttz16;
|
||||||
@ -50,7 +49,7 @@ impl Sudoku {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_vec(vec: &[[u8, ..9], ..9]) -> Sudoku {
|
pub fn from_vec(vec: &[[u8, ..9], ..9]) -> Sudoku {
|
||||||
let mut g = do vec::from_fn(9u) |i| {
|
let g = do vec::from_fn(9u) |i| {
|
||||||
do vec::from_fn(9u) |j| { vec[i][j] }
|
do vec::from_fn(9u) |j| { vec[i][j] }
|
||||||
};
|
};
|
||||||
return Sudoku::new(g)
|
return Sudoku::new(g)
|
||||||
@ -161,17 +160,17 @@ impl Sudoku {
|
|||||||
// Stores available colors as simple bitfield, bit 0 is always unset
|
// Stores available colors as simple bitfield, bit 0 is always unset
|
||||||
struct Colors(u16);
|
struct Colors(u16);
|
||||||
|
|
||||||
static heads: u16 = (1u16 << 10) - 1; /* bits 9..0 */
|
static HEADS: u16 = (1u16 << 10) - 1; /* bits 9..0 */
|
||||||
|
|
||||||
impl Colors {
|
impl Colors {
|
||||||
fn new(start_color: u8) -> Colors {
|
fn new(start_color: u8) -> Colors {
|
||||||
// Sets bits 9..start_color
|
// Sets bits 9..start_color
|
||||||
let tails = !0u16 << start_color;
|
let tails = !0u16 << start_color;
|
||||||
return Colors(heads & tails);
|
return Colors(HEADS & tails);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next(&self) -> u8 {
|
fn next(&self) -> u8 {
|
||||||
let val = **self & heads;
|
let val = **self & HEADS;
|
||||||
if (0u16 == val) {
|
if (0u16 == val) {
|
||||||
return 0u8;
|
return 0u8;
|
||||||
} else {
|
} else {
|
||||||
@ -190,7 +189,7 @@ impl Colors {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static default_sudoku: [[u8, ..9], ..9] = [
|
static DEFAULT_SUDOKU: [[u8, ..9], ..9] = [
|
||||||
/* 0 1 2 3 4 5 6 7 8 */
|
/* 0 1 2 3 4 5 6 7 8 */
|
||||||
/* 0 */ [0u8, 4u8, 0u8, 6u8, 0u8, 0u8, 0u8, 3u8, 2u8],
|
/* 0 */ [0u8, 4u8, 0u8, 6u8, 0u8, 0u8, 0u8, 3u8, 2u8],
|
||||||
/* 1 */ [0u8, 0u8, 8u8, 0u8, 2u8, 0u8, 0u8, 0u8, 0u8],
|
/* 1 */ [0u8, 0u8, 8u8, 0u8, 2u8, 0u8, 0u8, 0u8, 0u8],
|
||||||
@ -204,7 +203,7 @@ static default_sudoku: [[u8, ..9], ..9] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
static default_solution: [[u8, ..9], ..9] = [
|
static DEFAULT_SOLUTION: [[u8, ..9], ..9] = [
|
||||||
/* 0 1 2 3 4 5 6 7 8 */
|
/* 0 1 2 3 4 5 6 7 8 */
|
||||||
/* 0 */ [1u8, 4u8, 9u8, 6u8, 7u8, 5u8, 8u8, 3u8, 2u8],
|
/* 0 */ [1u8, 4u8, 9u8, 6u8, 7u8, 5u8, 8u8, 3u8, 2u8],
|
||||||
/* 1 */ [5u8, 3u8, 8u8, 1u8, 2u8, 9u8, 7u8, 4u8, 6u8],
|
/* 1 */ [5u8, 3u8, 8u8, 1u8, 2u8, 9u8, 7u8, 4u8, 6u8],
|
||||||
@ -258,10 +257,10 @@ fn colors_remove_works() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_default_sudoku_solution() {
|
fn check_DEFAULT_SUDOKU_solution() {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
let mut sudoku = Sudoku::from_vec(&default_sudoku);
|
let mut sudoku = Sudoku::from_vec(&DEFAULT_SUDOKU);
|
||||||
let solution = Sudoku::from_vec(&default_solution);
|
let solution = Sudoku::from_vec(&DEFAULT_SOLUTION);
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
sudoku.solve();
|
sudoku.solve();
|
||||||
@ -274,7 +273,7 @@ fn main() {
|
|||||||
let args = os::args();
|
let args = os::args();
|
||||||
let use_default = args.len() == 1u;
|
let use_default = args.len() == 1u;
|
||||||
let mut sudoku = if use_default {
|
let mut sudoku = if use_default {
|
||||||
Sudoku::from_vec(&default_sudoku)
|
Sudoku::from_vec(&DEFAULT_SUDOKU)
|
||||||
} else {
|
} else {
|
||||||
Sudoku::read(io::stdin())
|
Sudoku::read(io::stdin())
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,7 @@ enum UniqueList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (repeat, depth) = if os::getenv(~"RUST_BENCH").is_some() {
|
let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() {
|
||||||
(50, 1000)
|
(50, 1000)
|
||||||
} else {
|
} else {
|
||||||
(10, 10)
|
(10, 10)
|
||||||
|
@ -43,7 +43,7 @@ fn child_generation(gens_left: uint, c: comm::Chan<()>) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"100000"]
|
~[~"", ~"100000"]
|
||||||
} else if args.len() <= 1 {
|
} else if args.len() <= 1 {
|
||||||
~[~"", ~"100"]
|
~[~"", ~"100"]
|
||||||
|
@ -63,7 +63,7 @@ fn spawn_supervised_blocking(myname: &str, f: ~fn()) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"100000"]
|
~[~"", ~"100000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"100"]
|
~[~"", ~"100"]
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
// xfail-test OOM on linux-32 without opts
|
// xfail-test OOM on linux-32 without opts
|
||||||
|
|
||||||
use std::comm::*;
|
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
@ -49,7 +48,7 @@ fn calc(children: uint, parent_wait_chan: &Chan<Chan<Chan<int>>>) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"30"]
|
~[~"", ~"30"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10"]
|
~[~"", ~"10"]
|
||||||
|
@ -24,7 +24,7 @@ fn g() { }
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let args = if os::getenv(~"RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
~[~"", ~"400"]
|
~[~"", ~"400"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
~[~"", ~"10"]
|
~[~"", ~"10"]
|
||||||
|
Loading…
Reference in New Issue
Block a user