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

adding time complexity for partition_in_place iter method #85315

Merged
merged 2 commits into from
May 20, 2021

Conversation

satylogin
Copy link

I feel that one thing missing from rust docs compared to cpp references is existence of time complexity for all methods and functions. While it would be humongous task to include it for everything in single go, it is still doable if we as community keep on adding it in relevant places as and when we find them.

This PR adds the time complexity for partition_in_place method in iter.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @yaahc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 15, 2021
@yaahc
Copy link
Member

yaahc commented May 17, 2021

Hey @satylogin, thank you for the PR!

I agree that documenting our algorithms time complexity is a great idea but I want to be careful to make sure we show it in a way that doesn't imply that we're making any sort of stable guarantee that would prevent us from changing the complexity of the implementation in the future. We already have a similar section for sort, https://doc.rust-lang.org/stable/std/primitive.slice.html#current-implementation-6, that I think we should follow as a guide for how to structure this new section.

I think it might be as simple as adding a "# Current Implementation" header before the time complexity line you added. Though, it might be nice to also add an explanation about how the current implementation works, but I'll leave adding that up to your discretion.

@satylogin
Copy link
Author

Hi @yaahc I agree with all the comments and specially like the idea of maintaining consistency across docs as well the idea of bounding complexity to current implementation. Let me raise another revision with the modifications

…ounding complexity to current implementation
@satylogin
Copy link
Author

Hi @yaahc, I have updated the revision with algo explanation and put the info in the dedicated current implementation section.

@yaahc
Copy link
Member

yaahc commented May 19, 2021

Awesome, thank you.

@bors r+

@bors
Copy link
Contributor

bors commented May 19, 2021

📌 Commit 85e4177 has been approved by yaahc

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 19, 2021
@RalfJung
Copy link
Member

@bors rollup=always

bors added a commit to rust-lang-ci/rust that referenced this pull request May 20, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#84717 (impl FromStr for proc_macro::Literal)
 - rust-lang#85169 (Add method-toggle to <details> for methods)
 - rust-lang#85287 (Expose `Concurrent` (private type in public i'face))
 - rust-lang#85315 (adding time complexity for partition_in_place iter method)
 - rust-lang#85439 (Add diagnostic item to `CStr`)
 - rust-lang#85464 (Fix UB in documented example for `ptr::swap`)
 - rust-lang#85470 (Fix invalid CSS rules for a:hover)
 - rust-lang#85472 (CTFE Machine: do not expose Allocation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c1c4cd5 into rust-lang:master May 20, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants