comparator optimization