-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Const flags describing allocator properties #124
Comments
Can you give examples of how generic code (e.g. |
Would allow the in-place collect code in vec to apply in more cases.
can help picking between new-allocation-and-grow vs. reuse-allocation-and-shrink strategies. I.e. when shrinking incurs memcpy costs then it's better to use a fresh allocation from the beginning. It would also let us pick between realloc vs. alloc-manually-copy-dealloc when there's a huge discrepancy between capacity and length.
lets in-place-collect skip some realloc calls
for non-drop T we can turn Container's Drop into a noop And that's just examples. The list should be extensible of course. Flags would need to have conservative defaults. |
Another useful property would be if the allocator could indicate support for zero-sized allocations, e.g. by always returning |
It would be useful if allocators had an associated constant of flags describing their properties, such as
allocate
Containers can then choose to optimize their behavior based on those properties.
(from #120 (comment))
The text was updated successfully, but these errors were encountered: