Skip to content

New skip list#229

Draft
marvin-j97 wants to merge 16 commits intomainfrom
replace-skiplist
Draft

New skip list#229
marvin-j97 wants to merge 16 commits intomainfrom
replace-skiplist

Conversation

@marvin-j97
Copy link
Contributor

@marvin-j97 marvin-j97 commented Jan 4, 2026

Reopening of #131

Stuff to do:

  1. Make it compile
  2. Make buffer size configurable instead of being a const generic parameter
  3. Insertions of duplicates need to be rejected (not panic), to make batch writes with duplicate keys work
  4. Evaluate memory overhead vs crossbeam skiplist
  5. Evaluate read and write latency vs crossbeam skiplist
  6. Try in a full system (heavily cached) benchmark
  7. Remove crossbeam-skiplist
    (7. Model test against crossbeam-skiplist(

@marvin-j97 marvin-j97 added enhancement New feature or request help wanted Extra attention is needed type:memtable performance labels Jan 4, 2026
break;
}
height += 1;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a quicker way to get an exponential distribution if you are OK with base 2 instead of base e.

const MASK: u32 = !((1 << (MAX_HEIGHT as u32 - 1)) - 1);
let x = random_u32 | MASK;
let height = x.trailing_zeros() + 1;

// memory locality. A downside there is that we'd need to keep fixed-sized
// nodes. Perhaps a reasonable solution there might be to have only towers
// taller than 1 out-of-line and then we could iterate all the nodes more
// cheaply.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be worth addressing since user range queries already bounce around the skipmap in sorted order anyways...

... but, for what it's worth, you could solve this problem with minimal overhead by storing the height on each node in a clever way. Every node is aligned to 8 bytes, so the least significant 3 bits of each pointer in the tower are essentially free space. There are a few ways you could encode the height in those bits. Then you can iterate over the arena in linear order.

@matthew-mcallister
Copy link

I would be happy to contribute here if you want to share what you had in mind for benchmarking in points (3)-(5). Assuming you'll permit me to circle back to custom comparison functions after this PR is merged.

@marvin-j97
Copy link
Contributor Author

marvin-j97 commented Jan 28, 2026

I would be happy to contribute here if you want to share what you had in mind for benchmarking in points (3)-(5). Assuming you'll permit me to circle back to custom comparison functions after this PR is merged.

Benchmarking memory overhead should be pretty straightforward: just load tons of small values to see what the relative overhead of towers etc. is.

Benchmarking simple operations should be doable using criterion.

And full system benchmarks can be done using https://github.com/marvin-j97/rust-storage-bench/tree/v1, especially using the YCSB C workload with a small data set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request help wanted Extra attention is needed performance type:memtable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants