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

[perf] Use std based dedup in projection #47656

Merged
merged 2 commits into from
Jan 26, 2018
Merged

Conversation

ishitatsuyuki
Copy link
Contributor

Unstable sort was added recently, and the code that is being modified is 3 years old. As quicksort doesn't allocate it will likely perform as well as, or better than linear search.

I didn't benchmark. Have a perf run.

Unstable sort was added recently, and the code that is being modified is 3 years old. As quicksort doesn't allocate it will likely perform as well as, or better than linear search.
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@ishitatsuyuki ishitatsuyuki changed the title [perf] Use std based dedup in projection [wip][perf] Use std based dedup in projection Jan 22, 2018
@ishitatsuyuki
Copy link
Contributor Author

Hmm, so basically sorting fails because most types do not implement Ord. Is it a good idea to add derivation of them in this PR?

@kennytm
Copy link
Member

kennytm commented Jan 22, 2018

@ishitatsuyuki Let's add it, we need a perf check anyway. If it's unacceptable we could use sort_unstable_by_key.

@kennytm kennytm added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 22, 2018
@nikomatsakis
Copy link
Contributor

Seems fine. I'd like to see some perf results, for sure -- even a local run on some non-trivial test case might be of interest.

@ishitatsuyuki ishitatsuyuki force-pushed the patch-1 branch 2 times, most recently from b89ebbb to 732ee67 Compare January 22, 2018 23:41
@ishitatsuyuki ishitatsuyuki changed the title [wip][perf] Use std based dedup in projection [perf] Use std based dedup in projection Jan 23, 2018
@ishitatsuyuki
Copy link
Contributor Author

ishitatsuyuki commented Jan 23, 2018

Unwipped. Please perform a try and/or perf.

@Zoxc
Copy link
Contributor

Zoxc commented Jan 23, 2018

@bors try

@bors
Copy link
Contributor

bors commented Jan 23, 2018

⌛ Trying commit c6772b4 with merge 77de396b7685c2d4870314ad7ca865ad7b6feb5c...

@bors
Copy link
Contributor

bors commented Jan 23, 2018

☀️ Test successful - status-travis
State: approved= try=True

@ishitatsuyuki
Copy link
Contributor Author

@Mark-Simulacrum please perform a perf run.

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 23, 2018
@Mark-Simulacrum
Copy link
Member

Perf queued.

@ishitatsuyuki
Copy link
Contributor Author

ishitatsuyuki commented Jan 24, 2018

http://perf.rust-lang.org/compare.html?start=47a8eb7c4e24b61a8a9ab4eaff60ef65291aaa56&end=77de396b7685c2d4870314ad7ca865ad7b6feb5c&stat=instructions%3Au

... and well, surprisingly no noticable time change except one (see below). To sum up, the code is now cleaner and resistant to quadratic blowup, but some Ord implementations are added.

The case where quicksort probably shines:

| clean incremental-opt | 251066587932.00 | 206164489487.00 | -17.9% |

EDIT: this time is quite fluctuating and should not be used as a metric.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 25, 2018

📌 Commit c6772b4 has been approved by nikomatsakis

@nikomatsakis nikomatsakis 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 Jan 25, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 25, 2018
[perf] Use std based dedup in projection

Unstable sort was added recently, and the code that is being modified is 3 years old. As quicksort doesn't allocate it will likely perform as well as, or better than linear search.

I didn't benchmark. Have a perf run.
bors added a commit that referenced this pull request Jan 26, 2018
@bors bors merged commit c6772b4 into rust-lang:master Jan 26, 2018
@ishitatsuyuki ishitatsuyuki deleted the patch-1 branch July 15, 2018 13:26
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.

7 participants