Skip to content

Commit 2391c60

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163315 b: refs/heads/snap-stage3 c: 2160427 h: refs/heads/master i: 163313: 13e40f4 163311: cf4cd22 v: v3
1 parent 1f3129a commit 2391c60

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
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: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b
4+
refs/heads/snap-stage3: 2160427900ea675e494274d42a8d8485724f440e
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/test/bench/core-map.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unboxed_closures)]
12+
1113
use std::collections::{TrieMap, TreeMap, HashMap, HashSet};
1214
use std::os;
1315
use std::rand::{Rng, IsaacRng, SeedableRng};
1416
use std::time::Duration;
1517
use std::uint;
1618

17-
fn timed(label: &str, f: ||) {
19+
fn timed<F>(label: &str, f: F) where F: FnMut() {
1820
println!(" {}: {}", label, Duration::span(f));
1921
}
2022

branches/snap-stage3/src/test/bench/core-set.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// ignore-pretty very bad with line comments
1212

13+
#![feature(unboxed_closures)]
14+
1315
extern crate collections;
1416
extern crate rand;
1517

@@ -31,7 +33,7 @@ struct Results {
3133
delete_strings: Duration,
3234
}
3335

34-
fn timed(result: &mut Duration, op: ||) {
36+
fn timed<F>(result: &mut Duration, op: F) where F: FnOnce() {
3537
*result = Duration::span(op);
3638
}
3739

@@ -66,7 +68,7 @@ impl Results {
6668
rand_cap: uint,
6769
f: || -> T) { {
6870
let mut set = f();
69-
timed(&mut self.sequential_ints, || {
71+
timed(&mut self.sequential_ints, move || {
7072
for i in range(0u, num_keys) {
7173
set.insert(i);
7274
}
@@ -79,7 +81,7 @@ impl Results {
7981

8082
{
8183
let mut set = f();
82-
timed(&mut self.random_ints, || {
84+
timed(&mut self.random_ints, move || {
8385
for _ in range(0, num_keys) {
8486
set.insert(rng.gen::<uint>() % rand_cap);
8587
}
@@ -92,7 +94,7 @@ impl Results {
9294
set.insert(i);
9395
}
9496

95-
timed(&mut self.delete_ints, || {
97+
timed(&mut self.delete_ints, move || {
9698
for i in range(0u, num_keys) {
9799
assert!(set.remove(&i));
98100
}
@@ -108,7 +110,7 @@ impl Results {
108110
f: || -> T) {
109111
{
110112
let mut set = f();
111-
timed(&mut self.sequential_strings, || {
113+
timed(&mut self.sequential_strings, move || {
112114
for i in range(0u, num_keys) {
113115
set.insert(i.to_string());
114116
}
@@ -121,7 +123,7 @@ impl Results {
121123

122124
{
123125
let mut set = f();
124-
timed(&mut self.random_strings, || {
126+
timed(&mut self.random_strings, move || {
125127
for _ in range(0, num_keys) {
126128
let s = rng.gen::<uint>().to_string();
127129
set.insert(s);
@@ -134,7 +136,7 @@ impl Results {
134136
for i in range(0u, num_keys) {
135137
set.insert(i.to_string());
136138
}
137-
timed(&mut self.delete_strings, || {
139+
timed(&mut self.delete_strings, move || {
138140
for i in range(0u, num_keys) {
139141
assert!(set.remove(&i.to_string()));
140142
}

branches/snap-stage3/src/test/bench/core-std.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// Microbenchmarks for various functions in std and extra
1313

1414
#![feature(macro_rules)]
15+
#![feature(unboxed_closures)]
1516

1617
use std::io::File;
1718
use std::mem::swap;
@@ -41,7 +42,7 @@ fn main() {
4142
bench!(is_utf8_multibyte);
4243
}
4344

44-
fn maybe_run_test(argv: &[String], name: String, test: ||) {
45+
fn maybe_run_test<F>(argv: &[String], name: String, test: F) where F: FnOnce() {
4546
let mut run_test = false;
4647

4748
if os::getenv("RUST_BENCH").is_some() {

0 commit comments

Comments
 (0)