Note that until the fixes are merged, a relatively straightforward solution is to use sort!(collect(skipmissing(Y2)), alg=QuickSort). It’s about as fast as R and twice as fast as sort(Y2). It’s also what R does by default (na.last=NA), i.e. skipping NAs (keeping NAs doesn’t affect performance).
We should probably define sort(itr::SkipMissing) to call sort!(collect(itr), ...), since that’s a common need and it’s the most efficient possible definition.
To be honest, I think it is better to let new users understand that Julia is not always faster than R and Python. I keep seeing people getting frustrated about Julia when they find these cases.
I personally find that this community oversells Julia’s performance but undersells its syntax.
there are always multiple levels of understanding to this story. In this case, a relevant point is:
More importantly, in almost all cases, Julia can fix the problem by writing idiomatic Julia code, instead of MUST relying on C/C++/Fortran subroutine like you see in Python/R.
If you compare the time R/Python people spent in writing C/C++ code to the time someone in Julia community casually writing PRs to make a specific use faster, hopefully you’d see the qualitative difference and the long-term implication of this.