It looks like hash_search just does a linear walk if array entries to find elements in a list. This slows down (order N?) new inserts when the number of entries gets large.
Would there be any interest in merging a patch to add an option for making this faster (maybe using b-trees?) My analysis here https://eludom.github.io/blog/20200418/ Thanks, ---george jones