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

sortperm! allocates due to inference/type stability issues #47949

Closed
LilithHafner opened this issue Dec 21, 2022 · 0 comments · Fixed by #47966
Closed

sortperm! allocates due to inference/type stability issues #47949

LilithHafner opened this issue Dec 21, 2022 · 0 comments · Fixed by #47966
Labels
performance Must go faster sorting Put things in order

Comments

@LilithHafner
Copy link
Member

I don't know exactly why sortperm! allocates here, but I know that it shouldn't:

julia> v = rand(10);

julia> ix = similar(eachindex(v));

julia> @btime sortperm!($ix, $v) setup=(copyto!($ix, eachindex($v))) evals=1;
  939.000 ns (5 allocations: 336 bytes)

julia> @btime sort!($ix) setup=(sortperm!($ix, $v)) evals=1;
  84.000 ns (0 allocations: 0 bytes)

This is not new in 1.9 but it is slightly worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster sorting Put things in order
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant