[PATCH] Enhance _Hashtable for range insertion 0/5

François Dumont frs.dumont@gmail.com
Mon Jun 20 16:57:19 GMT 2022


Hi

Here is a series of patch to enhance _Hashtable behavior mostly in the 
context of range insertion. I also start considering the problem of 
memory fragmentation in this container with 2 objectives:

- It is easier to find out when you're done with the elements of a 
bucket if the last node of the bucket N is the before-begin node of 
bucket N + 1.

- It is faster to loop through nodes of a bucket if those node are close 
in memory, ultimately we should have addressof(Node + 1) == 
addressof(Node) + 1

[1/5] Make more use of user hints as both insertion and allocation hints.

[2/5] Introduce a new method to check if we are still looping through 
the same bucket's nodes

[3/5] Consider that all initializer_list elements are going to be inserted

[4/5] Introduce a before-begin cache policy to remember which bucket is 
currently pointing on it

[5/5] Prealloc nodes on _Hashtable copy and introduce a new assignment 
method which replicate buckets data structure

François



More information about the Libstdc++ mailing list