Is it possible to sort that data? Then you could use lower_bound instead of a linear scan.