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 Blake2 for the type-id hash #128597

Closed
wants to merge 6 commits into from

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Aug 3, 2024

and only for the TypeId hash, not as a general stable hasher.

cc @michaelwoerister

@rustbot

This comment was marked as off-topic.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 3, 2024
@Urgau
Copy link
Member Author

Urgau commented Aug 3, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

bors commented Aug 3, 2024

⌛ Trying commit 541f409 with merge cf164ca...

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 3, 2024
[perf] Use Blake2 for the type-id hash

and only for the `TypeId` hash, not as a general stable hasher.

cc `@michaelwoerister`
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 3, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 3, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Urgau
Copy link
Member Author

Urgau commented Aug 5, 2024

@bors try

@bors
Copy link
Contributor

bors commented Aug 5, 2024

⌛ Trying commit 28b8ba4 with merge 12daf8a...

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 5, 2024
[perf] Use Blake2 for the type-id hash

and only for the `TypeId` hash, not as a general stable hasher.

cc `@michaelwoerister`
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 5, 2024

💔 Test failed - checks-actions


// See https://stackoverflow.com/a/27952689 on why this function is
// implemented this way.
Fingerprint(p0.wrapping_mul(3).wrapping_add(p1), p2.wrapping_mul(3).wrapping_add(p3))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure you can just use Fingerprint(p0, p1). Blake2s is proven to be indistinguishable from a random function according to https://eprint.iacr.org/2016/827. If a prefix of the hash was biased, it wouldn't be indistinguishable from a random function. Because of the lack of bias on the low bytes, there is no need to mix in the high bytes.

@Urgau
Copy link
Member Author

Urgau commented Aug 15, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 15, 2024
[perf] Use Blake2 for the type-id hash

and only for the `TypeId` hash, not as a general stable hasher.

cc `@michaelwoerister`
@bors
Copy link
Contributor

bors commented Aug 15, 2024

⌛ Trying commit a42b030 with merge 3a79c24...

@bors
Copy link
Contributor

bors commented Aug 15, 2024

☀️ Try build successful - checks-actions
Build commit: 3a79c24 (3a79c247d7abef9e66f5f689fe7c7ffc16716f11)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3a79c24): comparison URL.

Overall result: ❌ regressions - BENCHMARK(S) FAILED

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 may lead to changes in compiler perf.

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

❗ ❗ ❗ ❗ ❗
Warning ⚠️: The following benchmark(s) failed to build:

  • regression-31157
  • issue-88862
  • serde-1.0.136

❗ ❗ ❗ ❗ ❗

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 5.3%, secondary -3.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
5.3% [5.3%, 5.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.3% [-3.6%, -3.0%] 2
All ❌✅ (primary) 5.3% [5.3%, 5.3%] 1

Cycles

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

Binary size

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

Bootstrap: 751.515s -> 753.185s (0.22%)
Artifact size: 339.18 MiB -> 339.18 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 15, 2024
@Urgau
Copy link
Member Author

Urgau commented Aug 16, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

bors commented Aug 16, 2024

⌛ Trying commit 41990be with merge c2fdbf6...

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2024
[perf] Use Blake2 for the type-id hash

and only for the `TypeId` hash, not as a general stable hasher.

cc `@michaelwoerister`
@michaelwoerister
Copy link
Member

@Urgau, before you invest too much time in this: I think it is preferable to go through (a possibly adapted version of) v0 mangling for type-id (and then potentially cryptographically hash that if constant space for type-ids is desirable).

@bors
Copy link
Contributor

bors commented Aug 16, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c2fdbf6): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

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 may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 1
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 2
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 5
All ❌✅ (primary) -0.2% [-0.2%, -0.2%] 2

Max RSS (memory usage)

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

Cycles

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

Binary size

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

Bootstrap: 751.027s -> 754.153s (0.42%)
Artifact size: 339.18 MiB -> 339.20 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 16, 2024
@Urgau Urgau added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 17, 2024
@Urgau Urgau closed this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc perf-regression Performance regression. S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants