I want to design a hash table library that keeps usage statistics and based on how it is used will use different implementations at runtime. For example use a certain implementation for small size hash tables and a different one for large ones (or tweak parameters to maximize cache hits).
For example let's say I have a SmallDataHashTable, optimized for small size tables, BigDataHashTable optimized for large ones, LookUpHashTable optimized for lookup, and InsertHashTable optimized for insertion deletion and so on. Instead of leaving it to the user (developer) to decide which one works best for their use case, I want to create a BestHashTable that adapts to the best implementation based on how it is being used. For example if the user is using mostly large tables with lots of insertions, then a certain implementation is used under the hood.
To summarize let's say I keep usage statistics for n parameters. I want to select/tune implementation based on these statistics:
1- Can such design even in theory be the "best" general use hash table?
2- How do I go about designing such data structure? (I will be implementing it in C++ if that matters)