Support using a hash table unless a really small input is used (may change in the future?)