array-hash icon indicating copy to clipboard operation
array-hash copied to clipboard

Custom allocators

Open michaeleisel opened this issue 5 years ago • 2 comments

It looks like a significant % of time can be spent in malloc and realloc. It would be awesome to be able to pass in custom allocators to speed those up.

michaeleisel avatar Feb 18 '20 17:02 michaeleisel

Hi,

Effectively, due to the nature of the data structure most time will be spend on allocations on insertion.

Currently there is no support for a custom allocator due to the fact that std::allocator_traits has no reallocate method. Using std::realloc with a char buffer allows the standard library implementation to do some potential extra optimizations.

I will see if I can add support for a custom allocator which must implement a realloc function in addition to the traits in std::allocator_traits.

Thibaut

Tessil avatar Feb 23 '20 16:02 Tessil

That'd be great, thanks!

michaeleisel avatar Feb 23 '20 18:02 michaeleisel