It would be slightly more efficient to filter first and then sort, because it will be a shorter array to sort.