This replaces the very questionable host::PoolAllocator with slabbin::SlabAllocator. The previous allocator was always just a stand-in for something more optimal anyway. The reason this is faster is because there isn't an additional computation when indexing, rather a raw pointer can be dereferenced directly.
I benchmarked allocating and deallocating 100,000 suballocations and this is the result:
test tests::before ... bench: 2,962,433 ns/iter (+/- 90,702)
test tests::after ... bench: 2,307,794 ns/iter (+/- 84,225)
Which looks like a 23% performance increase.
Note that the new code is no more unsafe than the old one. The unsafe was just very badly indicated :sweat_smile: which I fixed now.
This dependency will come in handly to speed up all kinds of internal data structures: I plan to use it for BuddyAllocator next and for a future FlsfAllocator, as well as for our range map and a future image subresource range map.
This replaces the very questionable
host::PoolAllocator
withslabbin::SlabAllocator
. The previous allocator was always just a stand-in for something more optimal anyway. The reason this is faster is because there isn't an additional computation when indexing, rather a raw pointer can be dereferenced directly.I benchmarked allocating and deallocating 100,000 suballocations and this is the result:
Which looks like a 23% performance increase.
Note that the new code is no more unsafe than the old one. The unsafe was just very badly indicated :sweat_smile: which I fixed now.
This dependency will come in handly to speed up all kinds of internal data structures: I plan to use it for
BuddyAllocator
next and for a futureFlsfAllocator
, as well as for our range map and a future image subresource range map.