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

sort: provide guidance on behavior if data is sorted, or almost-sorted #48528

Closed
kevinburke opened this issue Sep 21, 2021 · 3 comments
Closed

Comments

@kevinburke
Copy link
Contributor

It's not uncommon to have data that is almost sorted, or some data that is sorted and some data that is not sorted. For example, I was just working with a function that had one unsorted element, either at the beginning or end of an array, that needed to be sorted.

It might be nice to provide some guidance to users about the performance in this case; would Go still issue around n*log(n) calls to sort the data, or would the actual number be closer to n?

If it's not a good fit in the documentation, a blog post explaining the different optimizations in the sort package (if the data is small, we use this algorithm; large, this algorithm, here are the experiments we tried that weren't faster, etc.) might be neat.

@ianlancetaylor
Copy link
Contributor

I don't think this would be appropriate for the documentation because we can change the algorithm, and in fact we have done so in the past. A blog post would be fine.

@dr2chase
Copy link
Contributor

can this be closed? or is something else needed?

@kevinburke
Copy link
Contributor Author

Closed is fine I think

@golang golang locked and limited conversation to collaborators Sep 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants