You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By inspection of source code, it seems that RawVec is unaware of jemalloc bucket sizes. This is unfortunate, because it's wasteful to reallocate when the required capacity would fit within the current jemalloc allocation but RawVec just doesn't know.
I suggest that the allocator crate provide a rounding function for rounding up to the largest allocation size that would consume as much space in the underlying allocator as the requested size and RawVec use it to round up capacity. For jemalloc, the rounding function would round to the jemalloc bucket size.
The text was updated successfully, but these errors were encountered:
By inspection of source code, it seems that
RawVec
is unaware of jemalloc bucket sizes. This is unfortunate, because it's wasteful to reallocate when the required capacity would fit within the current jemalloc allocation butRawVec
just doesn't know.As far as abstraction leakage goes, it would be better to let the leakage stop at
RawVec
than to have higher-level code try to second-guessRawVec
with assumptions about the underlying allocator.I suggest that the allocator crate provide a rounding function for rounding up to the largest allocation size that would consume as much space in the underlying allocator as the requested size and
RawVec
use it to round up capacity. For jemalloc, the rounding function would round to the jemalloc bucket size.The text was updated successfully, but these errors were encountered: