Remove some users of io::file_reader
This commit is contained in:
parent
ff95904c48
commit
2290ce14f2
6 changed files with 68 additions and 30 deletions
|
|
@ -15,7 +15,6 @@
|
|||
extern mod extra;
|
||||
|
||||
use extra::time::precise_time_s;
|
||||
use std::io;
|
||||
use std::os;
|
||||
use std::rand::Rng;
|
||||
use std::rand;
|
||||
|
|
@ -70,11 +69,15 @@ fn shift_push() {
|
|||
}
|
||||
|
||||
fn read_line() {
|
||||
use std::rt::io::{Reader, Open};
|
||||
use std::rt::io::file::FileInfo;
|
||||
use std::rt::io::buffered::BufferedReader;
|
||||
|
||||
let path = Path(env!("CFG_SRC_DIR"))
|
||||
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
|
||||
|
||||
for _ in range(0, 3) {
|
||||
let reader = io::file_reader(&path).unwrap();
|
||||
let mut reader = BufferedReader::new(path.open_reader(Open).unwrap());
|
||||
while !reader.eof() {
|
||||
reader.read_line();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,17 +156,21 @@ fn make_sequence_processor(sz: uint,
|
|||
|
||||
// given a FASTA file on stdin, process sequence THREE
|
||||
fn main() {
|
||||
use std::rt::io::{Reader, Open};
|
||||
use std::rt::io::file::FileInfo;
|
||||
use std::rt::io::native::stdio;
|
||||
use std::rt::io::buffered::BufferedReader;
|
||||
|
||||
let rdr = if os::getenv("RUST_BENCH").is_some() {
|
||||
// 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)
|
||||
let path = Path(env!("CFG_SRC_DIR"))
|
||||
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
|
||||
io::file_reader(&path).unwrap()
|
||||
} else {
|
||||
io::stdin()
|
||||
};
|
||||
|
||||
|
||||
// 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)
|
||||
let path = Path(env!("CFG_SRC_DIR"))
|
||||
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
|
||||
~path.open_reader(Open).unwrap() as ~Reader
|
||||
} else {
|
||||
~stdio::stdin() as ~Reader
|
||||
};
|
||||
let mut rdr = BufferedReader::new(rdr);
|
||||
|
||||
// initialize each sequence sorter
|
||||
let sizes = ~[1u,2,3,4,6,12,18];
|
||||
|
|
@ -193,8 +197,11 @@ fn main() {
|
|||
// reading the sequence of interest
|
||||
let mut proc_mode = false;
|
||||
|
||||
while !rdr.eof() {
|
||||
let line: ~str = rdr.read_line();
|
||||
loop {
|
||||
let line = match rdr.read_line() {
|
||||
Some(ln) => ln, None => break,
|
||||
};
|
||||
let line = line.trim().to_owned();
|
||||
|
||||
if line.len() == 0u { continue; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue