Add `Reserve()` to `AutoProbing`
Adds a Reserve() method to AutoProbing that is necessary to get Bitextor's document aligner to work with this type of table.
I tried multiple setups where I just initialised the main table with a different size, but making sure the destination table is large enough with a Reserve call seems to be the only way to have any predictably good performance.
I also added a move-assignment operator to scoped_memory, the lack thereof prevented me to do df = std::move(local_df).
Things that can be improved:
- I didn't check if
AutoProbing's auto-generated move assignment operator is up to the job, but the output seems to be as expected. TheAutoProbingtable that was moved out from might be in a funny state though, with its counters not reset and no backing memory left. -
Reserve()is just a while-loop aroundDouble(), which is the laziest implementation possible but does a couple of pointless realloc calls.
Hmm, looking at this in https://github.com/jelmervdl/bitextor/pull/3 and using this table doesn't really yield an improvement over std::unordered_map in terms of memory usage.