message: Add a bench for SegmentPostings::SkipNext
diff: @@ -48,6 +48,7 @@ mod tests {
  use schema::Field;
  use test::Bencher;
  use indexer::operation::AddOperation;
  + use tests;
  use rand::{XorShiftRng, Rng, SeedableRng};
  @@ -289,4 +290,50 @@ mod tests {
  while intersection.advance() {}
  });
  }
  +
  + fn bench_skip_next(p: f32, b: &mut Bencher) {
  + let searcher = INDEX.searcher();
  + let segment_reader = searcher.segment_reader(0);
  + let docs = tests::sample(segment_reader.num_docs(), p);
  +
  + let mut segment_postings = segment_reader.read_postings(&*TERM_A, SegmentPostingsOption::NoFreq).unwrap();
  + let mut existing_docs = Vec::new();
  + for doc in &docs {
  + if *doc >= segment_postings.doc() {
  + existing_docs.push(*doc);
  + if segment_postings.skip_next(*doc) == SkipResult::End {
  + break;
  + }
  + }
  + }
  +
  + b.iter(|| {
  + let mut segment_postings = segment_reader.read_postings(&*TERM_A, SegmentPostingsOption::NoFreq).unwrap();
  + for doc in &existing_docs {
  + if segment_postings.skip_next(*doc) == SkipResult::End {
  + break;
  + }
  + }
  + });
  + }
  +
  + #[bench]
  + fn bench_skip_next_p01(b: &mut Bencher) {
  + bench_skip_next(0.001, b);
  + }
  +
  + #[bench]
  + fn bench_skip_next_p1(b: &mut Bencher) {
  + bench_skip_next(0.01, b);
  + }
  +
  + #[bench]
  + fn bench_skip_next_p10(b: &mut Bencher) {
  + bench_skip_next(0.1, b);
  + }
  +
  + #[bench]
  + fn bench_skip_next_p90(b: &mut Bencher) {
  + bench_skip_next(0.9, b);
  + }
  }
  