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

RawVec: don't recompute capacity after allocating. #92220

Merged
merged 1 commit into from Dec 24, 2021

Conversation

nnethercote
Copy link
Contributor

Currently it sets the capacity to ptr.len() / mem::size_of::<T>()
after any buffer allocation/reallocation. This would be useful if
allocators ever returned a NonNull<[u8]> with a size larger than
requested. But this never happens, so it's not useful.

Removing this slightly reduces the size of generated LLVM IR, and
slightly speeds up the hot path of RawVec growth.

r? @ghost

Currently it sets the capacity to `ptr.len() / mem::size_of::<T>()`
after any buffer allocation/reallocation. This would be useful if
allocators ever returned a `NonNull<[u8]>` with a size larger than
requested. But this never happens, so it's not useful.

Removing this slightly reduces the size of generated LLVM IR, and
slightly speeds up the hot path of `RawVec` growth.
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

I expect this will be tiny wins at best, it's more about the code cleanliness.

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 23, 2021
@bors
Copy link
Contributor

bors commented Dec 23, 2021

⌛ Trying commit 8217138 with merge bb1b81b9cddfac8bb2c85068496511df09d999bc...

@bors
Copy link
Contributor

bors commented Dec 23, 2021

☀️ Try build successful - checks-actions
Build commit: bb1b81b9cddfac8bb2c85068496511df09d999bc (bb1b81b9cddfac8bb2c85068496511df09d999bc)

@rust-timer
Copy link
Collaborator

Queued bb1b81b9cddfac8bb2c85068496511df09d999bc with parent e983092, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bb1b81b9cddfac8bb2c85068496511df09d999bc): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 23, 2021
@nnethercote
Copy link
Contributor Author

If you deselect "Filter out very small changes" in the perf results you see lots of tiny wins (< 0.3%), as expected.

@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 24, 2021

📌 Commit 8217138 has been approved by joshtriplett

@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 Dec 24, 2021
@bors
Copy link
Contributor

bors commented Dec 24, 2021

⌛ Testing commit 8217138 with merge e6f1f04...

@bors
Copy link
Contributor

bors commented Dec 24, 2021

☀️ Test successful - checks-actions
Approved by: joshtriplett
Pushing e6f1f04 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 24, 2021
@bors bors merged commit e6f1f04 into rust-lang:master Dec 24, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 24, 2021
@nnethercote nnethercote deleted the RawVec-dont-recompute-capacity branch December 24, 2021 06:23
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e6f1f04): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

None yet

5 participants