Skip to content

Commit 476e885

Browse files
committed
---
yaml --- r: 63604 b: refs/heads/snap-stage3 c: 6762754 h: refs/heads/master v: v3
1 parent 7f45220 commit 476e885

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 66fd3c9e5dd8c9b44237b57f455ba60ef607958b
4+
refs/heads/snap-stage3: 6762754d5b718d2d3f938963d2a4d82eb20eb9fd
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/test/bench/shootout-fasta.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -19,19 +19,15 @@ extern mod extra;
1919

2020
use std::int;
2121
use std::io;
22-
use std::option;
2322
use std::os;
2423
use std::rand::Rng;
2524
use std::rand;
2625
use std::result;
2726
use std::str;
2827
use std::uint;
29-
use std::vec;
3028

3129
static LINE_LENGTH: uint = 60u;
3230

33-
//fn LINE_LENGTH() -> uint { return 60u; }
34-
3531
struct MyRandom {
3632
last: u32
3733
}
@@ -95,17 +91,15 @@ fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
9591
wr.write_line(~">" + id + " " + desc);
9692
let mut op = str::with_capacity( LINE_LENGTH );
9793
let sl = s.len();
98-
unsafe {
99-
for uint::range(0u, n as uint) |i| {
100-
if (op.len() >= LINE_LENGTH) {
101-
wr.write_line( op );
102-
op = str::with_capacity( LINE_LENGTH );
103-
}
104-
op.push_char( s[i % sl] as char );
105-
}
106-
if op.len() > 0 {
107-
wr.write_line(op)
94+
for uint::range(0u, n as uint) |i| {
95+
if (op.len() >= LINE_LENGTH) {
96+
wr.write_line( op );
97+
op = str::with_capacity( LINE_LENGTH );
10898
}
99+
op.push_char( s[i % sl] as char );
100+
}
101+
if op.len() > 0 {
102+
wr.write_line(op)
109103
}
110104
}
111105
@@ -115,7 +109,7 @@ fn acid(ch: char, prob: u32) -> AminoAcids {
115109
116110
fn main() {
117111
let args = os::args();
118-
let args = if os::getenv(~"RUST_BENCH").is_some() {
112+
let args = if os::getenv("RUST_BENCH").is_some() {
119113
// alioth tests k-nucleotide with this data at 25,000,000
120114
~[~"", ~"5000000"]
121115
} else if args.len() <= 1u {
@@ -124,9 +118,9 @@ fn main() {
124118
args
125119
};
126120

127-
let writer = if os::getenv(~"RUST_BENCH").is_some() {
121+
let writer = if os::getenv("RUST_BENCH").is_some() {
128122
result::get(&io::file_writer(&Path("./shootout-fasta.data"),
129-
~[io::Truncate, io::Create]))
123+
[io::Truncate, io::Create]))
130124
} else {
131125
io::stdout()
132126
};

0 commit comments

Comments
 (0)