That3Percent / tree-buf

An experimental serialization system written in Rust
MIT License
264 stars 8 forks source link

Windowing to reduce buffer sizes #4

Open That3Percent opened 4 years ago

That3Percent commented 4 years ago

Right now, each leaf node in the tree keeps a single buffer and flushes all elements at once. This consumes much more memory than is necessary.

Instead, allocate buffers of fixed sizes (eg: 64k) and flush to a "window" whenever the buffer is full.