You could use a customised quicksort to find distinct values without iterating over the sorted array afterwards.
When you have chosen a pivot value and are moving through the respective part of the array, IF the value matches the pivot, discard it AND discard the pivot value after you have moved through the part of the array, this would remove duplicates BEFORE the array is eventually sorted.
ie:
Sorting [5, 1, 4, 1, 4, 1]
If you choose the pivot as 4, you'd end up with the 2 sub arrays being:
[1, 1, 1] and [5]
If your pivot is never discarded, it is distinct, if it is discarded do the same process on the sublists. If a sublist has only 1 element, it is distinct.
In this way you can pick up distinct values MUCH earlier.
Edit: Yes this is still bounded by O(nlogn) ( I think ?)