Skip to content

Commit 5245ace

Browse files
committed
test: Fix benchmarks. rs=rustbot
1 parent 5bd8692 commit 5245ace

File tree

5 files changed

+47
-52
lines changed

5 files changed

+47
-52
lines changed

src/test/bench/core-map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
extern mod std;
1818
use std::map;
19-
use mutable::Mut;
20-
use send_map::linear::*;
21-
use io::WriterUtil;
19+
use core::mutable::Mut;
20+
use core::send_map::linear::*;
21+
use core::io::WriterUtil;
2222

2323
struct Results {
2424
sequential_ints: float,
@@ -185,4 +185,4 @@ fn main() {
185185
rng, num_keys, &mut results);
186186
write_results("libstd::map::hashmap", &results);
187187
}
188-
}
188+
}

src/test/bench/graph500-bfs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ use std::map::HashMap;
2525
use std::deque;
2626
use std::deque::Deque;
2727
use std::par;
28-
use io::WriterUtil;
29-
use oldcomm::*;
30-
use int::abs;
28+
use core::io::WriterUtil;
29+
use core::oldcomm::*;
30+
use core::int::abs;
3131

3232
type node_id = i64;
3333
type graph = ~[~[node_id]];

src/test/bench/msgsend-ring.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
// that things will look really good once we get that lock out of the
1515
// message path.
1616

17-
use oldcomm::*;
17+
use core::oldcomm::*;
18+
use core::oldcomm;
1819

1920
extern mod std;
2021
use std::time;

src/test/bench/shootout-nbody.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
extern mod std;
1515

16+
use core::os;
17+
1618
// Using sqrt from the standard library is way slower than using libc
1719
// directly even though std just calls libc, I guess it must be
1820
// because the the indirection through another dynamic linker
@@ -45,9 +47,9 @@ fn main() {
4547
}
4648

4749
mod NBodySystem {
48-
#[legacy_exports];
50+
use Body;
4951

50-
fn make() -> ~[Body::props] {
52+
pub fn make() -> ~[Body::props] {
5153
let mut bodies: ~[Body::props] =
5254
~[Body::sun(),
5355
Body::jupiter(),
@@ -74,8 +76,7 @@ mod NBodySystem {
7476
return bodies;
7577
}
7678

77-
fn advance(bodies: &mut [Body::props], dt: float) {
78-
79+
pub fn advance(bodies: &mut [Body::props], dt: float) {
7980
let mut i = 0;
8081
while i < 5 {
8182
let mut j = i + 1;
@@ -95,16 +96,16 @@ mod NBodySystem {
9596
}
9697
}
9798

98-
fn advance_one(bi: &mut Body::props,
99-
bj: &mut Body::props,
100-
dt: float) unsafe {
99+
pub fn advance_one(bi: &mut Body::props,
100+
bj: &mut Body::props,
101+
dt: float) unsafe {
101102
let dx = bi.x - bj.x;
102103
let dy = bi.y - bj.y;
103104
let dz = bi.z - bj.z;
104105

105106
let dSquared = dx * dx + dy * dy + dz * dz;
106107

107-
let distance = libc::sqrt(dSquared);
108+
let distance = ::libc::sqrt(dSquared);
108109
let mag = dt / (dSquared * distance);
109110

110111
bi.vx -= dx * bj.mass * mag;
@@ -116,13 +117,13 @@ mod NBodySystem {
116117
bj.vz += dz * bi.mass * mag;
117118
}
118119

119-
fn move_(b: &mut Body::props, dt: float) {
120+
pub fn move_(b: &mut Body::props, dt: float) {
120121
b.x += dt * b.vx;
121122
b.y += dt * b.vy;
122123
b.z += dt * b.vz;
123124
}
124125

125-
fn energy(bodies: &[Body::props]) -> float unsafe {
126+
pub fn energy(bodies: &[Body::props]) -> float unsafe {
126127
let mut dx;
127128
let mut dy;
128129
let mut dz;
@@ -142,7 +143,7 @@ mod NBodySystem {
142143
dy = bodies[i].y - bodies[j].y;
143144
dz = bodies[i].z - bodies[j].z;
144145

145-
distance = libc::sqrt(dx * dx + dy * dy + dz * dz);
146+
distance = ::libc::sqrt(dx * dx + dy * dy + dz * dz);
146147
e -= bodies[i].mass * bodies[j].mass / distance;
147148

148149
j += 1;
@@ -156,14 +157,14 @@ mod NBodySystem {
156157
}
157158

158159
mod Body {
159-
#[legacy_exports];
160+
use Body;
160161

161-
const PI: float = 3.141592653589793;
162-
const SOLAR_MASS: float = 39.478417604357432;
162+
pub const PI: float = 3.141592653589793;
163+
pub const SOLAR_MASS: float = 39.478417604357432;
163164
// was 4 * PI * PI originally
164-
const DAYS_PER_YEAR: float = 365.24;
165+
pub const DAYS_PER_YEAR: float = 365.24;
165166

166-
type props =
167+
pub type props =
167168
{mut x: float,
168169
mut y: float,
169170
mut z: float,
@@ -172,7 +173,7 @@ mod Body {
172173
mut vz: float,
173174
mass: float};
174175

175-
fn jupiter() -> Body::props {
176+
pub fn jupiter() -> Body::props {
176177
return {mut x: 4.84143144246472090e+00,
177178
mut y: -1.16032004402742839e+00,
178179
mut z: -1.03622044471123109e-01,
@@ -182,7 +183,7 @@ mod Body {
182183
mass: 9.54791938424326609e-04 * SOLAR_MASS};
183184
}
184185

185-
fn saturn() -> Body::props {
186+
pub fn saturn() -> Body::props {
186187
return {mut x: 8.34336671824457987e+00,
187188
mut y: 4.12479856412430479e+00,
188189
mut z: -4.03523417114321381e-01,
@@ -192,7 +193,7 @@ mod Body {
192193
mass: 2.85885980666130812e-04 * SOLAR_MASS};
193194
}
194195

195-
fn uranus() -> Body::props {
196+
pub fn uranus() -> Body::props {
196197
return {mut x: 1.28943695621391310e+01,
197198
mut y: -1.51111514016986312e+01,
198199
mut z: -2.23307578892655734e-01,
@@ -202,7 +203,7 @@ mod Body {
202203
mass: 4.36624404335156298e-05 * SOLAR_MASS};
203204
}
204205

205-
fn neptune() -> Body::props {
206+
pub fn neptune() -> Body::props {
206207
return {mut x: 1.53796971148509165e+01,
207208
mut y: -2.59193146099879641e+01,
208209
mut z: 1.79258772950371181e-01,
@@ -212,7 +213,7 @@ mod Body {
212213
mass: 5.15138902046611451e-05 * SOLAR_MASS};
213214
}
214215

215-
fn sun() -> Body::props {
216+
pub fn sun() -> Body::props {
216217
return {mut x: 0.0,
217218
mut y: 0.0,
218219
mut z: 0.0,
@@ -222,7 +223,7 @@ mod Body {
222223
mass: SOLAR_MASS};
223224
}
224225

225-
fn offset_momentum(props: &mut Body::props,
226+
pub fn offset_momentum(props: &mut Body::props,
226227
px: float, py: float, pz: float) {
227228
props.vx = -px / SOLAR_MASS;
228229
props.vy = -py / SOLAR_MASS;

src/test/bench/task-perf-word-count-generic.rs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,20 @@
2222

2323
extern mod std;
2424

25-
use option = option;
26-
use option::Some;
27-
use option::None;
25+
use core::option;
2826
use std::map;
2927
use std::map::HashMap;
30-
use hash::Hash;
31-
use io::{ReaderUtil, WriterUtil};
28+
use core::hash::Hash;
29+
use core::io::{ReaderUtil, WriterUtil};
3230

3331
use std::time;
3432

35-
use oldcomm::Chan;
36-
use oldcomm::Port;
37-
use oldcomm::recv;
38-
use oldcomm::send;
39-
use cmp::Eq;
40-
use to_bytes::IterBytes;
33+
use core::oldcomm::Chan;
34+
use core::oldcomm::Port;
35+
use core::oldcomm::recv;
36+
use core::oldcomm::send;
37+
use core::cmp::Eq;
38+
use core::to_bytes::IterBytes;
4139

4240
macro_rules! move_out (
4341
{ $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
@@ -117,20 +115,15 @@ fn box<T>(+x: T) -> box<T> {
117115
}
118116

119117
mod map_reduce {
120-
#[legacy_exports];
121-
export putter;
122-
export getter;
123-
export mapper;
124-
export reducer;
125-
export map_reduce;
118+
use std::map;
126119

127-
type putter<K: Owned, V: Owned> = fn(&K, V);
120+
pub type putter<K: Owned, V: Owned> = fn(&K, V);
128121

129-
type mapper<K1: Owned, K2: Owned, V: Owned> = fn~(K1, putter<K2, V>);
122+
pub type mapper<K1: Owned, K2: Owned, V: Owned> = fn~(K1, putter<K2, V>);
130123

131-
type getter<V: Owned> = fn() -> Option<V>;
124+
pub type getter<V: Owned> = fn() -> Option<V>;
132125

133-
type reducer<K: Copy Owned, V: Copy Owned> = fn~(&K, getter<V>);
126+
pub type reducer<K: Copy Owned, V: Copy Owned> = fn~(&K, getter<V>);
134127

135128
enum ctrl_proto<K: Copy Owned, V: Copy Owned> {
136129
find_reducer(K, Chan<Chan<reduce_proto<V>>>),
@@ -245,7 +238,7 @@ mod map_reduce {
245238
(*reduce)(&key, || get(p, &mut ref_count, &mut is_done) );
246239
}
247240

248-
fn map_reduce<K1: Copy Owned, K2: Hash IterBytes Eq Const Copy Owned, V: Copy Owned>(
241+
pub fn map_reduce<K1: Copy Owned, K2: Hash IterBytes Eq Const Copy Owned, V: Copy Owned>(
249242
map: mapper<K1, K2, V>,
250243
reduce: reducer<K2, V>,
251244
inputs: ~[K1])

0 commit comments

Comments
 (0)