mozilla / rkv

A simple, humane, typed key-value storage solution.
https://crates.io/crates/rkv
Apache License 2.0
310 stars 53 forks source link

Delay short-circuiting `skip_while` and `filter` adaptors for better perforamnce in case of multi databases #177

Closed victorporof closed 4 years ago

victorporof commented 4 years ago

When generating iterators for multi databases, the (key, values) iterator generated by a snapshot is first flattened into (key, value) iterator; then, this iterator is transformed with skip_while and filter adaptors.

This approach can be less performant in a situation where a key can contain multiple values. In these situations, these adaptors do extra work because the flattening happens beforehand. Ideally, flattening should happen afterwards, which this PR implements.

Signed-off-by: Victor Porof victor.porof@gmail.com