File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 0b4d8d688240c229a4e3d51cdaa96899258a2340
2
+ refs/heads/master: fd757a8ab0f6bc84227d1ac7a83c55e09ea9dbcf
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
5
5
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
Original file line number Diff line number Diff line change @@ -568,6 +568,7 @@ pub struct BitvIterator<'self> {
568
568
}
569
569
570
570
impl < ' self > Iterator < bool > for BitvIterator < ' self > {
571
+ #[ inline]
571
572
fn next ( & mut self ) -> Option < bool > {
572
573
if self . next_idx < self . bitv . nbits {
573
574
let idx = self . next_idx ;
@@ -866,6 +867,7 @@ pub struct BitvSetIterator<'self> {
866
867
}
867
868
868
869
impl < ' self > Iterator < uint > for BitvSetIterator < ' self > {
870
+ #[ inline]
869
871
fn next( & mut self ) -> Option < uint > {
870
872
while self . next_idx < self . set. capacity ( ) {
871
873
let idx = self . next_idx ;
@@ -1566,4 +1568,38 @@ mod tests {
1566
1568
b1. union ( & b2) ;
1567
1569
}
1568
1570
}
1571
+
1572
+ #[ bench]
1573
+ fn bench_btv_small_iter ( b : & mut BenchHarness ) {
1574
+ let bitv = Bitv :: new ( uint:: bits, false ) ;
1575
+ do b. iter {
1576
+ let mut sum = 0 ;
1577
+ for bitv . iter( ) . advance |pres| {
1578
+ sum += pres as uint;
1579
+ }
1580
+ }
1581
+ }
1582
+
1583
+ #[ bench]
1584
+ fn bench_bitv_big_iter ( b : & mut BenchHarness ) {
1585
+ let bitv = Bitv :: new ( BENCH_BITS , false ) ;
1586
+ do b. iter {
1587
+ let mut sum = 0 ;
1588
+ for bitv . iter( ) . advance |pres| {
1589
+ sum += pres as uint;
1590
+ }
1591
+ }
1592
+ }
1593
+
1594
+ #[ bench]
1595
+ fn bench_bitvset_iter ( b : & mut BenchHarness ) {
1596
+ let bitv = BitvSet :: from_bitv ( from_fn ( BENCH_BITS ,
1597
+ |idx| { idx % 3 == 0 } ) ) ;
1598
+ do b. iter {
1599
+ let mut sum = 0 ;
1600
+ for bitv . iter( ) . advance |idx| {
1601
+ sum += idx;
1602
+ }
1603
+ }
1604
+ }
1569
1605
}
You can’t perform that action at this time.
0 commit comments