Efficiency improvement when building set of distinct values.