-
Notifications
You must be signed in to change notification settings - Fork 7.4k
qsort implementation to minimal stdlib #29804
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
Conversation
Signed-off-by: Jonathan Bruchim <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation from musl seems reasonable at first glance.
The license may be a problem.
It would be good to have a test, although I am not completely sure what the policy is for minimal libc as I know we don't have full test coverage, and since it implements a standard I think the direction was to find third-party test suite. But we have at least some tests in tests/lib/c_lib.
Probably need some input from the TSC on this.
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
I have some reservations about just copying from another project, although I haven't looked at the implementation.
A decent reference for some of these features are here: I mistakenly opened #31107 for this same topic since I've been carrying qsort.c in my greybus module for a while (from the BSD C library). However, due to the aforementioned concerns, I never bothered to make a PR. @JonBruchim - would you be able to provide some analysis of this vs possibly other algorithms? Just at a quick glance, Block Sort looks promising too. https://en.wikipedia.org/wiki/Block_sort
I haven't looked to see if it can be implemented easily though, or what kind of stack space it might require. That's also obviously a concern. I guess the only slight advantage that Block Sort might have is that it's stable. Smoothsort looks to have a reasonably simple implementation though. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
added musl implementation of qsort
http://git.musl-libc.org/cgit/musl/tree/src/stdlib/qsort.c
related to this issue i've opened
#28896
Signed-off-by: Jonathan Bruchim [email protected]