-
Notifications
You must be signed in to change notification settings - Fork 6.8k
an optimization for FindNextUserEntryInternal #151
Copy link
Copy link
Closed
Description
I've seen many innovations on rocksdb based on leveldb.
But, there is a hole we can do to improve.
As in skiplist, the internal key packed as:
{sequence|type|user_key|value}
if one key in skiplist is:
{100|0x01|'key1'|'val1'} -->node0
then, we insert same key with different value:
{101|0x01|'key1'|'val2'} -->node1
So, the same key is in two nodes, when we fall in the 'hot' function 'DBIter::FindNextUserEntryInternal', we have to do as follows:
if (ParseKey(&ikey) && ikey.sequence <= sequence_) {
if (skipping &&
user_comparator_->Compare(ikey.user_key, saved_key_.GetKey()) <= 0) {
if we changed the node structure from:
struct node {
Key key;
}
to
struct node {
Key keys[];
}
We don't need to do user_comparator_->Compare.
The 'iter->next' means that i am a 'restart'&'difference' key.
The OK version is here:
https://github.com/shuttler/nessDB/blob/master/engine/skiplist.h
https://github.com/shuttler/nessDB/blob/master/engine/skiplist.c
-BohuTANG
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels