Performance optimization: Do not search whole vector if we know we need all