Skip to content

an optimization for FindNextUserEntryInternal #151

@bohutang

Description

@bohutang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions