Closed StephanDollberg closed 1 month ago
@martinus I saw you reran the failed windows build but it failed again?
From what I can tell that issue is https://github.com/fmtlib/fmt/issues/3540 which is supposed to be fixed in fmt 10.
Added another commit to also allow choosing a custom container for the bucket array.
This is also an option to allow only segmenting the values array.
Hi @StephanDollberg and sorry for the long wait! Thanks a lot for your contribution, I've just merged it
In segmented mode we only applied the segmenting to the values array but not the bucket array.
As a result there the pattern of there still being a deallocation followed by an increased allocation when resizing the hash map continues to exist.
Further, in environments where the max allocation size is limited because of fragmentation issues this can lead to problems.
To avoid both of these issues this patch makes the bucket array use the same datastructure as the values array, i.e.: a
std::vector
when linear andsegmented_vector
when segmented (or the passed datastructure if specified).This extra indirection does add some overhead in the segmented case. Looking at the quick benchmarks we see:
Before:
After:
If we think this is not unconditionally acceptable then we could possibly add another template parameter (or make IsSegmented an enum) to decide which parts are supposed to be segmented.
Fixes https://github.com/martinus/unordered_dense/issues/94