rocksdb/memtable
Radoslaw Zarzynski 09b6bf828a InlineSkiplist: don't decode keys unnecessarily during comparisons
Summary:
Summary
========
`InlineSkipList<>::Insert` takes the `key` parameter as a C-string. Then, it performs multiple comparisons with it requiring the `GetLengthPrefixedSlice()` to be spawn in `MemTable::KeyComparator::operator()(const char* prefix_len_key1, const char* prefix_len_key2)` on the same data over and over. The patch tries to optimize that.

Rough performance comparison
=====
Big keys, no compression.

```
$ ./db_bench --writes 20000000 --benchmarks="fillrandom" --compression_type none -key_size 256
(...)
fillrandom   :       4.222 micros/op 236836 ops/sec;   80.4 MB/s
```

```
$ ./db_bench --writes 20000000 --benchmarks="fillrandom" --compression_type none -key_size 256
(...)
fillrandom   :       4.064 micros/op 246059 ops/sec;   83.5 MB/s
```

TODO
======
In ~~a separated~~ this PR:
- [x] Go outside the write path. Maybe even eradicate the C-string-taking variant of `KeyIsAfterNode` entirely.
- [x] Try to cache the transformations applied by `KeyComparator` & friends in situations where we havy many comparisons with the same key.
Closes https://github.com/facebook/rocksdb/pull/3516

Differential Revision: D7059300

Pulled By: ajkr

fbshipit-source-id: 6f027dbb619a488129f79f79b5f7dbe566fb2dbb
2018-03-23 12:14:30 -07:00
..
alloc_tracker.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
hash_cuckoo_rep.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
hash_cuckoo_rep.h Change RocksDB License 2017-07-15 16:11:23 -07:00
hash_linklist_rep.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
hash_linklist_rep.h Change RocksDB License 2017-07-15 16:11:23 -07:00
hash_skiplist_rep.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
hash_skiplist_rep.h Change RocksDB License 2017-07-15 16:11:23 -07:00
inlineskiplist.h InlineSkiplist: don't decode keys unnecessarily during comparisons 2018-03-23 12:14:30 -07:00
inlineskiplist_test.cc InlineSkiplist: don't decode keys unnecessarily during comparisons 2018-03-23 12:14:30 -07:00
memtablerep_bench.cc fix gflags namespace 2017-12-01 10:42:05 -08:00
skiplist.h Enable MSVC W4 with a few exceptions. Fix warnings and bugs 2017-10-19 10:57:12 -07:00
skiplist_test.cc Introduce bottom-pri thread pool for large universal compactions 2017-08-03 15:43:29 -07:00
skiplistrep.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
stl_wrappers.h Change RocksDB License 2017-07-15 16:11:23 -07:00
vectorrep.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
write_buffer_manager.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
write_buffer_manager_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00