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

Use get_many_mut to reduce the cost of setting up check cfg values #97657

Merged
merged 1 commit into from
Jun 21, 2022

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Jun 2, 2022

This PR use the newly added get_many_mut function in HashMap to reduce the cost of setting up the initial check cfg values.

cc @petrochenkov

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 2, 2022
@rust-highfive
Copy link
Collaborator

r? @oli-obk

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 2, 2022
@bjorn3
Copy link
Member

bjorn3 commented Jun 2, 2022

@bors try @rust-timer queue

@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 Jun 2, 2022
@bors
Copy link
Contributor

bors commented Jun 2, 2022

⌛ Trying commit e6acf5e2219c0e7991890c01244d868cca04b771 with merge 350ec00bebc560cbe87d5371aeccd39938af708b...

@bors
Copy link
Contributor

bors commented Jun 2, 2022

💔 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 Jun 2, 2022
@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member

bjorn3 commented Jun 2, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@bors
Copy link
Contributor

bors commented Jun 2, 2022

⌛ Trying commit 6a168e339e52c48615ab65416e12f74232ef2d68 with merge b3293a5514027cf3098be3a3662f26ea9d65d47c...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jun 2, 2022

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

@rust-timer
Copy link
Collaborator

Queued b3293a5514027cf3098be3a3662f26ea9d65d47c with parent 20976ba, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b3293a5514027cf3098be3a3662f26ea9d65d47c): comparison url.

Instruction count

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
1.0% 2.1% 12
Regressions 😿
(secondary)
1.0% 2.2% 39
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-0.7% -0.8% 8
All 😿🎉 (primary) 1.0% 2.1% 12

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)
2.9% 3.4% 7
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-3.6% -4.0% 2
All 😿🎉 (primary) N/A N/A 0

Cycles

Results
  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
2.6% 3.2% 2
Regressions 😿
(secondary)
3.1% 3.4% 2
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-3.7% -6.3% 3
All 😿🎉 (primary) 2.6% 3.2% 2

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 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-review -S-waiting-on-perf +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. 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 Jun 2, 2022
@Urgau
Copy link
Member Author

Urgau commented Jun 2, 2022

So this is perf neutral compare with the last perf run, 1082217 instructions more on the last perf run compare to now 1060315 instructions, -21902 instructions. So it's a very very tiny win.

Removing the perf-regression label because the feature is not activated by default (I only activated it for the perf run)
@rustbot label -perf-regression -S-waiting-on-author

@rustbot rustbot removed the perf-regression Performance regression. label Jun 2, 2022
@Urgau Urgau marked this pull request as ready for review June 2, 2022 21:38
@Urgau
Copy link
Member Author

Urgau commented Jun 20, 2022

Removing the perf-regression label because the feature is not activated by default (I only activated it for the perf run)

Which feature did you activate? It doesn't look to me like there's any conditional stuff going on. This is always executed and is a small perf regression across the board.

I activated the well known values checking of --check-cfg

well_known_values: false,

Though I am slighly confused about some of the cachegrind results. Why are there more Symbol::intern calls happening now?

Ah, it's probably because of the new targets that have been added between the two runs or maybe unrelated changes in the compiler. The two perf runs are separated by ~2 months.


I now realize that making the diff between those two perf run didn't show meaningful results because they were separated by a too long time.
I goal was to find out if there was some noticeable perf improvements and most importantly no regressions.

So my analysis was wrong, but I still think it's a improvement, eventhough I have no empirical data to prove it. Instead of doing 1760 (8 values * 220 targets ~= 1760 times) calls to entry we would only do 9 (8 call at the start and 1 to get_many_mut).

@oli-obk
Copy link
Contributor

oli-obk commented Jun 20, 2022

Ah! thanks

@bors r+

@bors
Copy link
Contributor

bors commented Jun 20, 2022

📌 Commit 5f04281 has been approved by oli-obk

@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 Jun 20, 2022
@bors
Copy link
Contributor

bors commented Jun 20, 2022

⌛ Testing commit 5f04281 with merge bfe83cd71331443df35b72f74e885e9ff7a80526...

@bors
Copy link
Contributor

bors commented Jun 20, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 20, 2022
@rust-log-analyzer
Copy link
Collaborator

The job dist-apple-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
      Memory: 14 GB
      System Firmware Version: VMW71.00V.13989454.B64.1906190538
      Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
      SMC Version (system): 2.8f0
      Serial Number (system): VMt8yMoxpV4P
      Provisioning UDID: 4203018E-580F-C1B5-9525-B745CECA79EB

hw.ncpu: 3
hw.byteorder: 1234
---
Consolidate compiler generated dependencies of target RTSanitizerCommon.osx
Consolidate compiler generated dependencies of target RTSanitizerCommonCoverage.osx
Consolidate compiler generated dependencies of target RTSanitizerCommonSymbolizer.osx
[ 71%] Built target RTSanitizerCommon.osx
make[3]: *** No rule to make target `/Users/runner/work/rust/rust/src/llvm�%�x��0��=¤� � _���YJ֗Ξ�� x��R6E�K��!)n�����', needed by `lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.osx.dir/sanitizer_symbolizer.cpp.o'.  Stop.
[ 71%] Built target RTSanitizerCommonCoverage.osx
make[2]: *** [lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.osx.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 71%] Built target RTInterception.osx
[ 71%] Built target RTInterception.osx
make[1]: *** [lib/lsan/CMakeFiles/clang_rt.lsan_osx_dynamic.dir/rule] Error 2
make: *** [clang_rt.lsan_osx_dynamic] Error 2
command did not execute successfully, got: exit status: 2


build script failed, must exit now', /Users/runner/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5
 finished in 288.194 seconds
Build completed unsuccessfully in 0:58:42

@oli-obk
Copy link
Contributor

oli-obk commented Jun 20, 2022

@bors retry make[3]: *** No rule to make target /Users/runner/work/rust/rust/src/llvm�%�x��0��=¤� � _���YJ֗Ξ�� x��R6E�K��!)n�����', needed by lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.osx.dir/sanitizer_symbolizer.cpp.o'. Stop.

@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 Jun 20, 2022
@bors
Copy link
Contributor

bors commented Jun 21, 2022

⌛ Testing commit 5f04281 with merge 4d9510446ed98449413c6c9c22b693851477dedf...

@bors
Copy link
Contributor

bors commented Jun 21, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 21, 2022
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@oli-obk
Copy link
Contributor

oli-obk commented Jun 21, 2022

@bors retry timeout

@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 Jun 21, 2022
@bors
Copy link
Contributor

bors commented Jun 21, 2022

⌛ Testing commit 5f04281 with merge abace0a...

@bors
Copy link
Contributor

bors commented Jun 21, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing abace0a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 21, 2022
@bors bors merged commit abace0a into rust-lang:master Jun 21, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 21, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (abace0a): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
0.2% 0.2% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

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)
2.2% 3.4% 2
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.0% -2.0% 1
All 😿🎉 (primary) N/A N/A 0

Cycles

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
2.1% 2.1% 1
Regressions 😿
(secondary)
2.1% 2.1% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.2% -2.3% 2
All 😿🎉 (primary) 2.1% 2.1% 1

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 3

  2. number of relevant changes 2 3

@weihanglo weihanglo mentioned this pull request May 4, 2024
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-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.

9 participants