RFC: Why `stable=True` is the default for `xp.sort`?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Begin with the xp.sort and xp.argsort entry points described in the issue and compare the stable-sort rationale with the cited NumPy behavior. Resolve whether the standard should retain stable defaults or permit unstable sorting for totally ordered non-complex data; done means the RFC has a decided, documented direction.
Written by the indexing model from the issue text.
Description
In xp.sort and xp.argsort, the sort is stable by default.
I understand very well the interest for argsort: I've seen a lot of bugs because people expected np.argsort to be stable.
And I guess sort is stable by default to match argsort behavior. But:
- stable sort is slower. Typically, 8x slower in numpy on my machine.
- for totally ordered data types, stable sort output is indistinguable from unstable sort output
- for complex numbers the doc says:
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent
So: are we sure it's a good idea to default to stable sort?
Alternatively: shouldn't we call unstable sort under-the-hood for non-complex numbers, even when stable=True?
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api
-
bug Maintenance Narrative Content
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in data-apis/array-api
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
StevenBlack/hosts#3256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
qualcomm/qai-appbuilder#275 ·