Skip to content

Commit 78de0d2

Browse files
committed
---
yaml --- r: 150739 b: refs/heads/try2 c: d1e2048 h: refs/heads/master i: 150737: 620bcd5 150735: ee6a659 v: v3
1 parent 3bce200 commit 78de0d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+524
-540
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b7e93067732ac1398a74958a3b1b0f6fa72fee8d
8+
refs/heads/try2: d1e20488a5d1258b1582caa2db77e5210b8bd28f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-testing.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ runner.
170170

171171
The type signature of a benchmark function differs from a unit test:
172172
it takes a mutable reference to type
173-
`test::Bencher`. Inside the benchmark function, any
173+
`test::BenchHarness`. Inside the benchmark function, any
174174
time-variable or "setup" code should execute first, followed by a call
175175
to `iter` on the benchmark harness, passing a closure that contains
176176
the portion of the benchmark you wish to actually measure the
@@ -189,16 +189,16 @@ For example:
189189
extern crate test;
190190
191191
use std::slice;
192-
use test::Bencher;
192+
use test::BenchHarness;
193193
194194
#[bench]
195-
fn bench_sum_1024_ints(b: &mut Bencher) {
195+
fn bench_sum_1024_ints(b: &mut BenchHarness) {
196196
let v = slice::from_fn(1024, |n| n);
197197
b.iter(|| {v.iter().fold(0, |old, new| old + *new);} );
198198
}
199199
200200
#[bench]
201-
fn initialise_a_vector(b: &mut Bencher) {
201+
fn initialise_a_vector(b: &mut BenchHarness) {
202202
b.iter(|| {slice::from_elem(1024, 0u64);} );
203203
b.bytes = 1024 * 8;
204204
}
@@ -249,11 +249,11 @@ it entirely.
249249
~~~
250250
# #[allow(unused_imports)];
251251
extern crate test;
252-
use test::Bencher;
252+
use test::BenchHarness;
253253
254254
#[bench]
255-
fn bench_xor_1000_ints(b: &mut Bencher) {
256-
b.iter(|| {
255+
fn bench_xor_1000_ints(bh: &mut BenchHarness) {
256+
bh.iter(|| {
257257
range(0, 1000).fold(0, |old, new| old ^ new);
258258
});
259259
}

branches/try2/src/libarena/lib.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,9 @@ impl<T> Drop for TypedArena<T> {
481481
#[cfg(test)]
482482
mod tests {
483483
extern crate test;
484-
use self::test::Bencher;
484+
485+
486+
use self::test::BenchHarness;
485487
use super::{Arena, TypedArena};
486488

487489
struct Point {
@@ -503,9 +505,9 @@ mod tests {
503505
}
504506

505507
#[bench]
506-
pub fn bench_copy(b: &mut Bencher) {
508+
pub fn bench_copy(bh: &mut BenchHarness) {
507509
let arena = TypedArena::new();
508-
b.iter(|| {
510+
bh.iter(|| {
509511
arena.alloc(Point {
510512
x: 1,
511513
y: 2,
@@ -515,8 +517,8 @@ mod tests {
515517
}
516518

517519
#[bench]
518-
pub fn bench_copy_nonarena(b: &mut Bencher) {
519-
b.iter(|| {
520+
pub fn bench_copy_nonarena(bh: &mut BenchHarness) {
521+
bh.iter(|| {
520522
~Point {
521523
x: 1,
522524
y: 2,
@@ -526,9 +528,9 @@ mod tests {
526528
}
527529

528530
#[bench]
529-
pub fn bench_copy_old_arena(b: &mut Bencher) {
531+
pub fn bench_copy_old_arena(bh: &mut BenchHarness) {
530532
let arena = Arena::new();
531-
b.iter(|| {
533+
bh.iter(|| {
532534
arena.alloc(|| {
533535
Point {
534536
x: 1,
@@ -556,9 +558,9 @@ mod tests {
556558
}
557559

558560
#[bench]
559-
pub fn bench_noncopy(b: &mut Bencher) {
561+
pub fn bench_noncopy(bh: &mut BenchHarness) {
560562
let arena = TypedArena::new();
561-
b.iter(|| {
563+
bh.iter(|| {
562564
arena.alloc(Noncopy {
563565
string: ~"hello world",
564566
array: vec!( 1, 2, 3, 4, 5 ),
@@ -567,8 +569,8 @@ mod tests {
567569
}
568570

569571
#[bench]
570-
pub fn bench_noncopy_nonarena(b: &mut Bencher) {
571-
b.iter(|| {
572+
pub fn bench_noncopy_nonarena(bh: &mut BenchHarness) {
573+
bh.iter(|| {
572574
~Noncopy {
573575
string: ~"hello world",
574576
array: vec!( 1, 2, 3, 4, 5 ),
@@ -577,9 +579,9 @@ mod tests {
577579
}
578580

579581
#[bench]
580-
pub fn bench_noncopy_old_arena(b: &mut Bencher) {
582+
pub fn bench_noncopy_old_arena(bh: &mut BenchHarness) {
581583
let arena = Arena::new();
582-
b.iter(|| {
584+
bh.iter(|| {
583585
arena.alloc(|| Noncopy {
584586
string: ~"hello world",
585587
array: vec!( 1, 2, 3, 4, 5 ),

branches/try2/src/libcollections/bitv.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ impl<'a> Iterator<uint> for BitPositions<'a> {
940940
#[cfg(test)]
941941
mod tests {
942942
extern crate test;
943-
use self::test::Bencher;
943+
use self::test::BenchHarness;
944944

945945
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
946946
from_bytes};
@@ -1557,7 +1557,7 @@ mod tests {
15571557
}
15581558

15591559
#[bench]
1560-
fn bench_uint_small(b: &mut Bencher) {
1560+
fn bench_uint_small(b: &mut BenchHarness) {
15611561
let mut r = rng();
15621562
let mut bitv = 0 as uint;
15631563
b.iter(|| {
@@ -1567,7 +1567,7 @@ mod tests {
15671567
}
15681568

15691569
#[bench]
1570-
fn bench_small_bitv_small(b: &mut Bencher) {
1570+
fn bench_small_bitv_small(b: &mut BenchHarness) {
15711571
let mut r = rng();
15721572
let mut bitv = SmallBitv::new(uint::BITS);
15731573
b.iter(|| {
@@ -1577,7 +1577,7 @@ mod tests {
15771577
}
15781578

15791579
#[bench]
1580-
fn bench_big_bitv_small(b: &mut Bencher) {
1580+
fn bench_big_bitv_small(b: &mut BenchHarness) {
15811581
let mut r = rng();
15821582
let mut bitv = BigBitv::new(vec!(0));
15831583
b.iter(|| {
@@ -1587,7 +1587,7 @@ mod tests {
15871587
}
15881588

15891589
#[bench]
1590-
fn bench_big_bitv_big(b: &mut Bencher) {
1590+
fn bench_big_bitv_big(b: &mut BenchHarness) {
15911591
let mut r = rng();
15921592
let mut storage = vec!();
15931593
storage.grow(BENCH_BITS / uint::BITS, &0u);
@@ -1599,7 +1599,7 @@ mod tests {
15991599
}
16001600

16011601
#[bench]
1602-
fn bench_bitv_big(b: &mut Bencher) {
1602+
fn bench_bitv_big(b: &mut BenchHarness) {
16031603
let mut r = rng();
16041604
let mut bitv = Bitv::new(BENCH_BITS, false);
16051605
b.iter(|| {
@@ -1609,7 +1609,7 @@ mod tests {
16091609
}
16101610

16111611
#[bench]
1612-
fn bench_bitv_small(b: &mut Bencher) {
1612+
fn bench_bitv_small(b: &mut BenchHarness) {
16131613
let mut r = rng();
16141614
let mut bitv = Bitv::new(uint::BITS, false);
16151615
b.iter(|| {
@@ -1619,7 +1619,7 @@ mod tests {
16191619
}
16201620

16211621
#[bench]
1622-
fn bench_bitv_set_small(b: &mut Bencher) {
1622+
fn bench_bitv_set_small(b: &mut BenchHarness) {
16231623
let mut r = rng();
16241624
let mut bitv = BitvSet::new();
16251625
b.iter(|| {
@@ -1629,7 +1629,7 @@ mod tests {
16291629
}
16301630

16311631
#[bench]
1632-
fn bench_bitv_set_big(b: &mut Bencher) {
1632+
fn bench_bitv_set_big(b: &mut BenchHarness) {
16331633
let mut r = rng();
16341634
let mut bitv = BitvSet::new();
16351635
b.iter(|| {
@@ -1639,7 +1639,7 @@ mod tests {
16391639
}
16401640

16411641
#[bench]
1642-
fn bench_bitv_big_union(b: &mut Bencher) {
1642+
fn bench_bitv_big_union(b: &mut BenchHarness) {
16431643
let mut b1 = Bitv::new(BENCH_BITS, false);
16441644
let b2 = Bitv::new(BENCH_BITS, false);
16451645
b.iter(|| {
@@ -1648,7 +1648,7 @@ mod tests {
16481648
}
16491649

16501650
#[bench]
1651-
fn bench_btv_small_iter(b: &mut Bencher) {
1651+
fn bench_btv_small_iter(b: &mut BenchHarness) {
16521652
let bitv = Bitv::new(uint::BITS, false);
16531653
b.iter(|| {
16541654
let mut _sum = 0;
@@ -1659,7 +1659,7 @@ mod tests {
16591659
}
16601660

16611661
#[bench]
1662-
fn bench_bitv_big_iter(b: &mut Bencher) {
1662+
fn bench_bitv_big_iter(b: &mut BenchHarness) {
16631663
let bitv = Bitv::new(BENCH_BITS, false);
16641664
b.iter(|| {
16651665
let mut _sum = 0;
@@ -1670,7 +1670,7 @@ mod tests {
16701670
}
16711671

16721672
#[bench]
1673-
fn bench_bitvset_iter(b: &mut Bencher) {
1673+
fn bench_bitvset_iter(b: &mut BenchHarness) {
16741674
let bitv = BitvSet::from_bitv(from_fn(BENCH_BITS,
16751675
|idx| {idx % 3 == 0}));
16761676
b.iter(|| {

branches/try2/src/libcollections/deque.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ pub trait Deque<T> : Mutable {
4242
#[cfg(test)]
4343
pub mod bench {
4444
extern crate test;
45-
use self::test::Bencher;
45+
use self::test::BenchHarness;
4646
use std::container::MutableMap;
4747
use rand;
4848
use rand::Rng;
4949

5050
pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
5151
map: &mut M,
52-
b: &mut Bencher) {
52+
bh: &mut BenchHarness) {
5353
// setup
5454
let mut rng = rand::weak_rng();
5555

@@ -59,7 +59,7 @@ pub mod bench {
5959
}
6060

6161
// measure
62-
b.iter(|| {
62+
bh.iter(|| {
6363
let k = rng.gen::<uint>() % n;
6464
map.insert(k, 1);
6565
map.remove(&k);
@@ -68,7 +68,7 @@ pub mod bench {
6868

6969
pub fn insert_seq_n<M:MutableMap<uint,uint>>(n: uint,
7070
map: &mut M,
71-
b: &mut Bencher) {
71+
bh: &mut BenchHarness) {
7272
// setup
7373
map.clear();
7474
for i in range(0u, n) {
@@ -77,7 +77,7 @@ pub mod bench {
7777

7878
// measure
7979
let mut i = 1;
80-
b.iter(|| {
80+
bh.iter(|| {
8181
map.insert(i, 1);
8282
map.remove(&i);
8383
i = (i + 2) % n;
@@ -86,7 +86,7 @@ pub mod bench {
8686

8787
pub fn find_rand_n<M:MutableMap<uint,uint>>(n: uint,
8888
map: &mut M,
89-
b: &mut Bencher) {
89+
bh: &mut BenchHarness) {
9090
// setup
9191
let mut rng = rand::weak_rng();
9292
let mut keys = Vec::from_fn(n, |_| rng.gen::<uint>() % n);
@@ -99,23 +99,23 @@ pub mod bench {
9999

100100
// measure
101101
let mut i = 0;
102-
b.iter(|| {
102+
bh.iter(|| {
103103
map.find(keys.get(i));
104104
i = (i + 1) % n;
105105
})
106106
}
107107

108108
pub fn find_seq_n<M:MutableMap<uint,uint>>(n: uint,
109109
map: &mut M,
110-
b: &mut Bencher) {
110+
bh: &mut BenchHarness) {
111111
// setup
112112
for i in range(0u, n) {
113113
map.insert(i, 1);
114114
}
115115

116116
// measure
117117
let mut i = 0;
118-
b.iter(|| {
118+
bh.iter(|| {
119119
let x = map.find(&i);
120120
i = (i + 1) % n;
121121
x

0 commit comments

Comments
 (0)