5

Cache flags for `ty::Const` by compiler-errors · Pull Request #118189 · rust-lan...

 9 months ago
source link: https://github.com/rust-lang/rust/pull/118189
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in rustc_type_ir, since we can assume that consts have a flags method that is no-cost.

r? @ghost

rustbot

added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Nov 22, 2023

This comment has been minimized.

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

Nov 22, 2023

Contributor

⌛ Trying commit 4ec6857 with merge d300094...

Contributor

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

This comment has been minimized.

Collaborator

Finished benchmarking commit (d300094): comparison URL.

Overall result: ✅ improvements - no 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.

@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
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 12
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 4
All ❌✅ (primary) -0.3% [-0.4%, -0.2%] 12

Max RSS (memory usage)

Results

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: 675.896s -> 674.726s (-0.17%)
Artifact size: 313.66 MiB -> 313.53 MiB (-0.04%)

lqd reacted with hooray emoji

rustbot

removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

Nov 23, 2023

compiler-errors

marked this pull request as ready for review

November 24, 2023 02:09

Member

Author

cool beans

r? @nnethercote

you have any idea why this wasn't attempted sooner? i may be missing some history/background of WithCachedTypeInfo, and i feel like you'd know it, since you're the perf guy.

Member

Author

@compiler-errors compiler-errors

left a comment

There are likely other folders/visiting that could take advantage of the fact that consts have an O(1) flag/outer_exclusive_binder computation, and short-circuit folding/visiting in this case. I'll leave that up to follow-ups.

nnethercote reacted with thumbs up emoji
@@ -28,10 +28,11 @@ impl FlagComputation {

result

}

pub fn for_const(c: ty::Const<'_>) -> TypeFlags {

pub fn for_const(c: &ty::ConstKind<'_>, t: Ty<'_>) -> FlagComputation {

Maybe this should take &ConstData?

self.add_exclusive_binder(c.outer_exclusive_binder());

}

fn add_const_kind(&mut self, c: &ty::ConstKind<'_>) {

I actually am unsure if it's more efficient just to take the ConstKind by value here.

Contributor

I think @oli-obk added WithCachedTypeInfo. I suspect consts weren't done just because they're so much less common than types, so the potential wins are a lot smaller.

@bors r+

Contributor

📌 Commit 4ec6857 has been approved by nnethercote

It is now in the queue for this repository.

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

Nov 24, 2023

Contributor

⌛ Testing commit 4ec6857 with merge 41fe75e...

Contributor

☀️ Test successful - checks-actions
Approved by: nnethercote
Pushing 41fe75e to master...

bors

added the merged-by-bors This PR was explicitly merged by bors label

Nov 24, 2023

bors

merged commit 41fe75e into

rust-lang:master

Nov 24, 2023

12 checks passed

Collaborator

Finished benchmarking commit (41fe75e): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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
Improvements ✅
(primary)
-0.3% [-0.3%, -0.2%] 10
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.2%] 3
All ❌✅ (primary) -0.3% [-0.3%, -0.2%] 10

Max RSS (memory usage)

Results

Cycles

Results

Binary size

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

Bootstrap: 675.697s -> 676.001s (0.04%)
Artifact size: 313.74 MiB -> 313.55 MiB (-0.06%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Back to tour

No reviews

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

Milestone

1.76.0

Development

Successfully merging this pull request may close these issues.

None yet

5 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK