Reduce pointer indirections
hawkw opened this issue · 0 comments
Currently, looking up an item in the slab requires dereferencing three to four Box
es: the box around the shard slice:
Line 202 in b160433
the box around the page data slice (or slices, depending on the operation):
Lines 244 to 249 in b160433
and the box around each page's slot slice:
Line 73 in b160433
It would be good to reduce the number of dereferences. Ideally, we could use fixed size arrays, since the slab is configured at compile time; however, doing this nicely would require const generics. Alternatively, we could consider using DSTs for at least some of our structs. However, this would require manually managing our allocations, and would still require some boxing — it would take careful design to actually reduce derefs with DSTs.
Since a slab is (almost) always in an Arc
in most use-cases, we might want to make the entire slab a DST, reducing at least one box...this could have ergonomic disadvantages though.