I ran some benchmarks on different clear options:
1) just try_emplace into the new map
2) the process in this PR (including the scary-looking memcopy)
3) the process in this PR used for constexpr contexts (no memcopy)
The above graph was created with a "fresh" map, starting empty and then pushing each element once. This means the linked list is in perfect order so we don't see the locality issues of using linked lists. Instead, I generated a "used" linked list by repeatedly deleting and replacing subsets of the array, yielding the following results:
I ran some benchmarks on different clear options: 1) just
try_emplace
into the new map 2) the process in this PR (including the scary-looking memcopy) 3) the process in this PR used for constexpr contexts (no memcopy)The above graph was created with a "fresh" map, starting empty and then pushing each element once. This means the linked list is in perfect order so we don't see the locality issues of using linked lists. Instead, I generated a "used" linked list by repeatedly deleting and replacing subsets of the array, yielding the following results: