Request for feedback on WG14 proposal N3849 (alloc_at_least)
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Thu Apr 23 20:23:36 GMT 2026
Hi Florian,
>> I didn't find a clear motivation about performance in the proposal.
>> However realloc is *fast* if the size fits or is a little smaller: it takes
>> less than 5 cycles on a modern CPU (over 550 million calls per second).
>
> If you don't know the allocator internals, you can't tell which realloc
> arguments are actually fast (or which arguments to malloc produce zero
> unused slack).
You can write nano benchmarks/tests like I did to get the above stat. It's easy
to figure out mapping of input sizes to block sizes - the main gotcha is large
malloc of a multiple of page size as due to the chunk header a whole page
gets wasted if mmap is used.
Cheers,
Wilco
More information about the Libc-alpha
mailing list