Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Non allocating sort for tuple #54489

Open
jw3126 opened this issue May 16, 2024 · 1 comment · May be fixed by #54494
Open

Feature request: Non allocating sort for tuple #54489

jw3126 opened this issue May 16, 2024 · 1 comment · May be fixed by #54494
Assignees
Labels
domain:sorting Put things in order kind:feature Indicates new feature / enhancement requests kind:reverted This PR has since been reverted

Comments

@jw3126
Copy link
Contributor

jw3126 commented May 16, 2024

I think it would be very cool if one could do e.g.

sort((1,4,5,3))

and it would return a sorted tuple blazing fast without allocs. There are packages in the ecosystem like
SortingNetworks.jl that can do this, but they cannot overload Base.sort without piracy. So if sort is used inside some other function it is still slow even on tuples.
Would it makes sense to add fast NTuple sort to Base?

@nsajko nsajko added kind:feature Indicates new feature / enhancement requests domain:sorting Put things in order labels May 16, 2024
@LilithHafner
Copy link
Member

We had support for this in #46104. The whole thing got reverted on the grounds of making it harder to define custom sorting functions in a package in a nonbreaking way, but sort(x::NTuple) can and should reland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:sorting Put things in order kind:feature Indicates new feature / enhancement requests kind:reverted This PR has since been reverted
Projects
None yet
4 participants