sortBy: internally cache the keyValue comparator