gnzlbg / slice_deque

A contiguous-in-memory double-ended queue that derefs into a slice
https://docs.rs/crate/slice-deque/
Other
154 stars 21 forks source link

Turn the mirrored allocation module (except for the buffer) into an Allocator #21

Open gnzlbg opened 6 years ago

gnzlbg commented 6 years ago

Currently each SliceDeque is its own allocator, this means that allocating, growing and deallocating SliceDeques require system calls because we are bypassing the global allocator (which recycles memory pages across allocations to avoid system calls).

The target is probably the 0.5 release but work for this can already start. The goals I wanted for the allocator are:

My thoughts on how to attack small SliceDeques are:

My thought on how to attack arbitrary large SliceDeques are:

Some unknowns I have about this are:

[0] : P.-V. Khuong, P. Morin, Array layouts for comparison-based searching, 2017.

pinging @bill-myers because he was interested into getting this into the library

mikeash commented 6 years ago

The Triplicate section of this blog post explains why my version of this needs three regions:

https://mikeash.com/pyblog/friday-qa-2012-02-17-ring-buffers-and-mirrored-memory-part-ii.html

gnzlbg commented 6 years ago

I've submitted a PR that implements this #33