-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
Currently a Slab<(u64, u64)> uses 24 bytes per element. This overhead comes from Entry being an enum.
To remove this overhead completely, Entry must become a union. But then:
- iteration can't be supported efficiently
- even without iteration,
removeandgetbecome unsafe
If slab keys become a struct with no public fields the interface becomes a bit safer but still not safe. Nevertheless this is probably a good idea anyway.
To remove most of the overhead, the slab can contain a bitmap of occupied/vacant entries instead of using the enum tag. This has some advantages:
- iteration is supported and is more efficient for sparse slabs (you can skip a lot of entries by counting zeros/ones)
removeandgetare now safe again
And disadvantages:- safe operations can potentially exhibit 2 cache misses per op instead of 1 (one in bitmap, one in vector)
What do you think? Does any of these have place in slab? Or do you think these implementation choices deserve their own (different) crate?
Metadata
Metadata
Assignees
Labels
No labels