Lite3: Treating serialized data as a B-tree
PerformanceComments
Since it is a contiguous buffer, how does Lite3 handle deletions or key updates that change the size of the value without shifting the rest of the B-tree?
This is useful for the low-power sensors I deal with. When you only have a few kilobytes of RAM, you cannot afford to translate a JSON blob into an object just to check a status flag.
I disagree that cache locality is a given here. Jumping through a B-tree in a raw buffer can trigger more cache misses than a linear scan of a packed, serialized array.
Is it actually the fastest globally? FlatBuffers and Cap'n Proto already treat the wire format as the memory format. This feels like a rebranding of zero-copy.
unlike flatbuffers, the b-tree allows in-place mutations without re-allocating the whole buffer.
We saw this approach trend during the early Rust storage wave. The novelty usually wears off once the buffer fragmentation makes those O(log n) mutations a nightmare to manage.
If the buffer is small enough to fit in L3 cache, would the fragmentation Marcus mentioned be a secondary concern compared to the speed of direct access? It is possible the performance gain outweighs the memory overhead for specific workloads.