Skip to content

Replace pointer casting in hashmap_random_keys with safe code #100298

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

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

BlackHoleFox
Copy link
Contributor

The old code was unnecessarily unsafe and relied on the layout of tuples always being the same as an array of the same size (which might be bad with -Z randomize-layout)?

The replacement has identical codegen, so it seems like a reasonable change.

The old code was unnecessarily unsafe and relied on the layout
of tuples always being the same as an array of the same size.
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 9, 2022
@rust-highfive
Copy link
Contributor

r? @thomcc

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot
Copy link
Collaborator

rustbot commented Aug 9, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 9, 2022
@Mark-Simulacrum
Copy link
Member

@bors r+ rollup=never in case there's perf implications, though I don't expect any.

@bors
Copy link
Collaborator

bors commented Aug 9, 2022

📌 Commit 0cf9503 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@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 Aug 9, 2022
@bors
Copy link
Collaborator

bors commented Aug 11, 2022

⌛ Testing commit 0cf9503 with merge 1876544...

@bors
Copy link
Collaborator

bors commented Aug 11, 2022

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 1876544 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 11, 2022
@bors bors merged commit 1876544 into rust-lang:master Aug 11, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 11, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1876544): comparison url.

Instruction count

  • Primary benchmarks: ✅ relevant improvements found
  • Secondary benchmarks: ✅ relevant improvement found
mean1 max count2
Regressions ❌
(primary)
N/A N/A 0
Regressions ❌
(secondary)
N/A N/A 0
Improvements ✅
(primary)
-0.2% -0.2% 5
Improvements ✅
(secondary)
-0.2% -0.2% 1
All ❌✅ (primary) -0.2% -0.2% 5

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions ❌
(primary)
N/A N/A 0
Regressions ❌
(secondary)
4.0% 4.0% 1
Improvements ✅
(primary)
N/A N/A 0
Improvements ✅
(secondary)
-3.3% -3.3% 1
All ❌✅ (primary) N/A N/A 0

Cycles

This benchmark run did not return any relevant results for this metric.

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

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@BlackHoleFox BlackHoleFox deleted the hashmap_keygen_cleanup branch August 19, 2022 00:28
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants