Default allocator of container plus element type

Moritz Maxeiner moritz at ucworks.org
Thu Oct 5 11:45:59 UTC 2017


On Thursday, 5 October 2017 at 11:35:30 UTC, Nordlöw wrote:
> Would it be possible to set up a mapping (either formal or 
> informal) of each typical container (such as array, linked-list 
> etc) plus element type to a suitable default allocator? And 
> perhaps add this to the documentation of 
> `std.experimental.allocator`?
>
> I currently get the feeling that most programmers have no idea 
> at all what allocator to choose for each given combination of 
> container and element type they want to use.

I'm skeptical towards such a mapping being universally applicable 
(or even applicable in the majority of cases), because the best 
allocation strategy for a specific use case is not determined 
solely by (container,element), it's (at least) 
(container,element,usage scenario, operating system, hardware) - 
and I'm sure I forgot some.
Realistically, if you care about picking the best memory 
allocator for your use case, imho you should write your 
application to be agnostic to the allocator used and then 
benchmark it with a bunch of different allocators.


More information about the Digitalmars-d mailing list