Skip to content

Commit

Permalink
bench: fix a few compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tshepang committed Jan 8, 2015
1 parent 2a8cb67 commit 0f4ee2d
Show file tree
Hide file tree
Showing 19 changed files with 14 additions and 43 deletions.
1 change: 0 additions & 1 deletion src/test/bench/core-map.rs
Expand Up @@ -14,7 +14,6 @@ use std::collections::{BTreeMap, HashMap, HashSet};
use std::os;
use std::rand::{Rng, IsaacRng, SeedableRng};
use std::time::Duration;
use std::uint;

fn timed<F>(label: &str, f: F) where F: FnMut() {
println!(" {}: {}", label, Duration::span(f));
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/core-set.rs
Expand Up @@ -21,7 +21,6 @@ use std::collections::HashSet;
use std::hash::Hash;
use std::os;
use std::time::Duration;
use std::uint;

struct Results {
sequential_ints: Duration,
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/core-uint-to-str.rs
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

use std::os;
use std::uint;

fn main() {
let args = os::args();
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/msgsend-pipes-shared.rs
Expand Up @@ -22,7 +22,6 @@ use std::sync::mpsc::{channel, Sender, Receiver};
use std::os;
use std::thread::Thread;
use std::time::Duration;
use std::uint;

fn move_out<T>(_x: T) {}

Expand Down
5 changes: 1 addition & 4 deletions src/test/bench/msgsend-pipes.rs
Expand Up @@ -18,9 +18,6 @@ use std::sync::mpsc::{channel, Sender, Receiver};
use std::os;
use std::thread::Thread;
use std::time::Duration;
use std::uint;

fn move_out<T>(_x: T) {}

enum request {
get_count,
Expand All @@ -42,7 +39,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
_ => { }
}
}
responses.send(count);
responses.send(count).unwrap();
//println!("server exiting");
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/bench/msgsend-ring-mutex-arcs.rs
Expand Up @@ -21,7 +21,6 @@
use std::os;
use std::sync::{Arc, Future, Mutex, Condvar};
use std::time::Duration;
use std::uint;

// A poor man's pipe.
type pipe = Arc<(Mutex<Vec<uint>>, Condvar)>;
Expand Down Expand Up @@ -76,7 +75,7 @@ fn main() {
let num_tasks = args[1].parse::<uint>().unwrap();
let msg_per_task = args[2].parse::<uint>().unwrap();

let (mut num_chan, num_port) = init();
let (num_chan, num_port) = init();

let mut p = Some((num_chan, num_port));
let dur = Duration::span(|| {
Expand Down
7 changes: 3 additions & 4 deletions src/test/bench/rt-parfib.rs
Expand Up @@ -11,23 +11,22 @@
use std::sync::mpsc::channel;
use std::os;
use std::thread::Thread;
use std::uint;

// A simple implementation of parfib. One subtree is found in a new
// task and communicated over a oneshot pipe, the other is found
// locally. There is no sequential-mode threshold.

fn parfib(n: uint) -> uint {
if(n == 0 || n == 1) {
if n == 0 || n == 1 {
return 1;
}

let (tx, rx) = channel();
Thread::spawn(move|| {
tx.send(parfib(n-1));
tx.send(parfib(n-1)).unwrap();
});
let m2 = parfib(n-2);
return (rx.recv().unwrap() + m2);
return rx.recv().unwrap() + m2;
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-binarytrees.rs
Expand Up @@ -92,7 +92,7 @@ fn main() {
let long_lived_arena = TypedArena::new();
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);

let mut messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
let messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
use std::num::Int;
let iterations = 2i.pow((max_depth - depth + min_depth) as uint);
Thread::scoped(move|| {
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-chameneos-redux.rs
Expand Up @@ -182,7 +182,7 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
let (to_rendezvous_log, from_creatures_log) = channel::<String>();

// these channels will allow us to talk to each creature by 'name'/index
let mut to_creature: Vec<Sender<CreatureInfo>> =
let to_creature: Vec<Sender<CreatureInfo>> =
set.iter().enumerate().map(|(ii, &col)| {
// create each creature as a listener with a port, and
// give us a channel to talk to each
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-fannkuch-redux.rs
Expand Up @@ -130,7 +130,7 @@ impl Perm {
}


fn reverse(tperm: &mut [i32], mut k: uint) {
fn reverse(tperm: &mut [i32], k: uint) {
tperm.slice_to_mut(k).reverse()
}

Expand Down Expand Up @@ -165,7 +165,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
let mut futures = vec![];
let k = perm.max() / N;

for (i, j) in range(0, N).zip(iter::count(0, k)) {
for (_, j) in range(0, N).zip(iter::count(0, k)) {
let max = cmp::min(j+k, perm.max());

futures.push(Thread::scoped(move|| {
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/shootout-k-nucleotide.rs
Expand Up @@ -43,7 +43,6 @@
#![feature(slicing_syntax)]

use std::ascii::OwnedAsciiExt;
use std::iter::repeat;
use std::slice;
use std::sync::Arc;
use std::thread::Thread;
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-nbody.rs
Expand Up @@ -202,6 +202,6 @@ fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> {
raw.data = raw.data.offset(1);
raw.len -= 1;
*r = mem::transmute(raw);
Some(unsafe { &mut *ret })
Some({ &mut *ret })
}
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-reverse-complement.rs
Expand Up @@ -229,7 +229,7 @@ unsafe impl<T: 'static> Send for Racy<T> {}

/// Executes a closure in parallel over the given iterator over mutable slice.
/// The closure `f` is run in parallel with an element of `iter`.
fn parallel<'a, I, T, F>(mut iter: I, f: F)
fn parallel<'a, I, T, F>(iter: I, f: F)
where T: 'a+Send + Sync,
I: Iterator<Item=&'a mut [T]>,
F: Fn(&mut [T]) + Sync {
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-threadring.rs
Expand Up @@ -43,7 +43,7 @@ use std::thread::Thread;

fn start(n_tasks: int, token: int) {
let (tx, mut rx) = channel();
tx.send(token);
tx.send(token).unwrap();
for i in range(2, n_tasks + 1) {
let (tx, next_rx) = channel();
Thread::spawn(move|| roundtrip(i, tx, rx));
Expand All @@ -58,7 +58,7 @@ fn roundtrip(id: int, tx: Sender<int>, rx: Receiver<int>) {
println!("{}", id);
break;
}
tx.send(token - 1);
tx.send(token - 1).unwrap();
}
}

Expand Down
1 change: 0 additions & 1 deletion src/test/bench/std-smallintmap.rs
Expand Up @@ -13,7 +13,6 @@
use std::collections::VecMap;
use std::os;
use std::time::Duration;
use std::uint;

fn append_sequential(min: uint, max: uint, map: &mut VecMap<uint>) {
for i in range(min, max) {
Expand Down
14 changes: 1 addition & 13 deletions src/test/bench/sudoku.rs
Expand Up @@ -54,18 +54,6 @@ impl Sudoku {
return Sudoku::new(g)
}

pub fn equal(&self, other: &Sudoku) -> bool {
for row in range(0u8, 9u8) {
for col in range(0u8, 9u8) {
if self.grid[row as uint][col as uint] !=
other.grid[row as uint][col as uint] {
return false;
}
}
}
return true;
}

pub fn read(mut reader: &mut BufferedReader<StdReader>) -> Sudoku {
/* assert first line is exactly "9,9" */
assert!(reader.read_line().unwrap() == "9,9".to_string());
Expand Down Expand Up @@ -183,7 +171,7 @@ impl Colors {
fn next(&self) -> u8 {
let Colors(c) = *self;
let val = c & HEADS;
if (0u16 == val) {
if 0u16 == val {
return 0u8;
} else {
return val.trailing_zeros() as u8
Expand Down
4 changes: 0 additions & 4 deletions src/test/bench/task-perf-alloc-unwind.rs
Expand Up @@ -19,10 +19,6 @@ enum List<T> {
Nil, Cons(T, Box<List<T>>)
}

enum UniqueList {
ULNil, ULCons(Box<UniqueList>)
}

fn main() {
let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() {
(50, 1000)
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/task-perf-jargon-metal-smoke.rs
Expand Up @@ -20,7 +20,6 @@
use std::sync::mpsc::{channel, Sender};
use std::os;
use std::thread::Thread;
use std::uint;

fn child_generation(gens_left: uint, tx: Sender<()>) {
// This used to be O(n^2) in the number of generations that ever existed.
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/task-perf-spawnalot.rs
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

use std::os;
use std::uint;
use std::thread::Thread;

fn f(n: uint) {
Expand Down

11 comments on commit 0f4ee2d

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at tshepang@0f4ee2d

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging 1 batched pull requests into batch

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "dcb2592c9a2d3f26ffaae9f6aa9d743ed16a8fc2", "rollup_pulls": [[20718, "0f4ee2d87e77e311201ce7cbf523d2632809ce35"]]}

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing rollup candidate = dcb2592

Successful merges:

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at tshepang@0f4ee2d

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging 3 batched pull requests into batch

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "32545a0460755727d8c91c6ddad173964128a74a", "rollup_pulls": [[20718, "0f4ee2d87e77e311201ce7cbf523d2632809ce35"], [20741, "b527494d2d1d705d9aa8c4c0c9042e63d9825619"], [20779, "1f550b47c23f064c95eff0d2510910a385b8a5fd"]]}

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing rollup candidate = 32545a0

Successful merges:

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 32545a0

@bors
Copy link
Contributor

@bors bors commented on 0f4ee2d Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 32545a0

Please sign in to comment.