This is a simple improvement to the performance of the duplicate input check in CheckTransaction.
It includes the benchmark from #14387, for which it shows about a 2x speedup compared to master (while #14387 shows a 4.5x speedup, but with a lot more complexity).