llvm / llvm/llvm-project

[libc++] Consider adding an `allocate_at_least`-like function to the new-family of functions

Open
#212,790 1 comment 0 reactions 1 assignee Claimed by @philnik777 View on GitHub
libc++ performance
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Currently `std::allocator`'s `allocate_at_least` simply allocates an exact amount of memory. Instead, we could introduce a function like `allocation_result __new_at_least(size_t count)` which uses platform-specific functions to do what `allocate_at_least` is intended for: returning the actual amount of memory allocated.

This would improve performance of e.g. `vector` and `string`, since they use `allocate_at_least` internally.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.