Tomislav Novak 88edfd90ae SkipListRep::LookaheadIterator
Summary:
This diff introduces the `lookahead` argument to `SkipListFactory()`. This is an
optimization for the tailing use case which includes many seeks. E.g. consider
the following operations on a skip list iterator:

   Seek(x), Next(), Next(), Seek(x+2), Next(), Seek(x+3), Next(), Next(), ...

If `lookahead` is positive, `SkipListRep` will return an iterator which also
keeps track of the previously visited node. Seek() then first does a linear
search starting from that node (up to `lookahead` steps). As in the tailing
example above, this may require fewer than ~log(n) comparisons as with regular
skip list search.

Test Plan:
Added a new benchmark (`fillseekseq`) which simulates the usage pattern. It
first writes N records (with consecutive keys), then measures how much time it
takes to read them by calling `Seek()` and `Next()`.

   $ time ./db_bench -num 10000000 -benchmarks fillseekseq -prefix_size 1 \
      -key_size 8 -write_buffer_size $[1024*1024*1024] -value_size 50 \
      -seekseq_next 2 -skip_list_lookahead=0
   [...]
   DB path: [/dev/shm/rocksdbtest/dbbench]
   fillseekseq  :       0.389 micros/op 2569047 ops/sec;

   real    0m21.806s
   user    0m12.106s
   sys     0m9.672s

   $ time ./db_bench [...] -skip_list_lookahead=2
   [...]
   DB path: [/dev/shm/rocksdbtest/dbbench]
   fillseekseq  :       0.153 micros/op 6540684 ops/sec;

   real    0m19.469s
   user    0m10.192s
   sys     0m9.252s

Reviewers: ljin, sdong, igor

Reviewed By: igor

Subscribers: dhruba, leveldb, march, lovro

Differential Revision: https://reviews.facebook.net/D23997
2014-10-07 11:48:23 -07:00
..
2014-08-14 17:01:20 -07:00
2014-05-08 13:50:49 -07:00
2014-04-15 13:39:26 -07:00
2014-04-15 13:39:26 -07:00
2014-09-16 10:30:32 -07:00
2014-05-02 16:24:04 -04:00
2014-08-19 09:52:54 -04:00
2014-08-19 06:48:21 -07:00
2014-08-19 06:48:21 -07:00
2014-04-04 14:03:19 -07:00
2014-09-05 14:14:37 +08:00
2014-05-21 07:54:22 -04:00
2014-07-08 12:31:49 -07:00
2014-08-11 13:22:47 -04:00
2014-09-04 23:06:23 +08:00
2014-09-04 23:06:23 +08:00
2014-08-28 12:46:05 -04:00
2014-08-28 12:46:05 -04:00
2014-09-21 22:20:00 +08:00
2014-09-24 13:12:16 -07:00
2014-09-05 14:14:37 +08:00
2014-09-15 20:43:38 +08:00
2014-07-25 15:17:06 -07:00
2014-10-07 11:48:23 -07:00
2014-09-05 14:14:37 +08:00
2014-07-28 12:10:49 -07:00
2013-12-03 12:42:15 -08:00
2014-07-28 12:22:37 -07:00
2014-04-09 21:17:14 -07:00
2014-04-09 21:17:14 -07:00
2014-04-17 14:29:28 -07:00
2014-04-25 09:50:51 -04:00
2014-09-08 22:24:40 -07:00
2014-09-08 22:24:40 -07:00
2014-08-27 11:05:41 -07:00
2014-05-01 14:09:32 -04:00
2014-05-01 14:09:32 -04:00