Conversation
| break; | ||
| } | ||
| height += 1; | ||
| } |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
|
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. |
Reopening of #131
Stuff to do:
(7. Model test against crossbeam-skiplist(