An unordered set can tell if an element is present in ~O(1) time (constant on
average, worst case linear to the size of the container), which speeds up and
simplifies the lookup in IsEvicted().
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
This is a backport of core#20197 [3/6]
https://github.com/bitcoin/bitcoin/pull/20197/commits/ca63b53ecdf377ce777fd959d400748912266748
Depends on D10976