Skip to content

Reduce some queries around associated items #145266

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 14, 2025

Conversation

camsteffen
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2025

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Aug 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@petrochenkov
Copy link
Contributor

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 11, 2025
Reduce some queries around associated items
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 11, 2025
@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 11, 2025
@rust-bors
Copy link

rust-bors bot commented Aug 11, 2025

☀️ Try build successful (CI)
Build commit: 811ef38 (811ef38822ea064db8fdb0a434857b88b1a36cd3, parent: fce0e74720d199eb7839fdb51af35ac5226da178)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (811ef38): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

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

Instruction count

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

Max RSS (memory usage)

Results (secondary -2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

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

Cycles

Results (primary 2.5%, secondary 8.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
8.9% [6.1%, 11.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.5% [2.5%, 2.5%] 1

Binary size

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

Bootstrap: 464.993s -> 464.719s (-0.06%)
Artifact size: 377.36 MiB -> 377.36 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 12, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Aug 12, 2025

Cache hits of the def_kind and impl_trait_header have been reduced. No otherwise measurable impact, but it usually takes several changes like this to positively affect perf

@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 12, 2025
@petrochenkov
Copy link
Contributor

There are two kinds of changes here:

  • the changes that simplify code - these are good
  • the changes that do not simplify code, but should be optimizations in theory, but are not noticeable in practice - I'm not sure we should merge those

Although it looks like we can optimize some primitives here, making the code both simpler and more micro-optimized, let me write some inline comments.

@petrochenkov
Copy link
Contributor

Although it looks like we can optimize some primitives here

Hm, actually not, the def kind checks are not redundant, some are on the def-id itself, and some are on its parent.

@petrochenkov
Copy link
Contributor

I think this would benefit from

  • a version of assoc_parent returning DefKind in addition to DefId,
  • maybe also having trait_impl_of_assoc/inherent_impl_of_assoc in addition to just impl_of_assoc,
  • removing micro-optimizations that do not fit into the pattern above ^^^ and hand roll some logic just to save a call to def_kind

@rustbot author

@rustbot rustbot 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 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 12, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@camsteffen
Copy link
Contributor Author

I went with all of your ideas and I think it looks nice! @rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 12, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 12, 2025
@petrochenkov
Copy link
Contributor

r=me with #145266 (comment) addressed.
@bors rollup=maybe

@petrochenkov petrochenkov 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 13, 2025
@camsteffen
Copy link
Contributor Author

@bors r=petrochenkov

@bors
Copy link
Collaborator

bors commented Aug 13, 2025

@camsteffen: 🔑 Insufficient privileges: Not in reviewers

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 13, 2025

📌 Commit d4eb094 has been approved by petrochenkov

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 13, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 14, 2025
…chenkov

Reduce some queries around associated items
bors added a commit that referenced this pull request Aug 14, 2025
Rollup of 13 pull requests

Successful merges:

 - #122661 (Change the desugaring of `assert!` for better error output)
 - #142372 (Improve `--remap-path-prefix` documentation)
 - #143075 (compiler: Allow `extern "interrupt" fn() -> !`)
 - #145005 (strip prefix of temporary file names when it exceeds filesystem name length limit)
 - #145065 (resolve: Introduce `RibKind::Block`)
 - #145120 (llvm: Accept new LLVM lifetime format)
 - #145189 (Weekly `cargo update`)
 - #145261 (Improve tracing in bootstrap)
 - #145266 (Reduce some queries around associated items)
 - #145299 (doc test: fix mpsc.rs try_send doc test)
 - #145331 (Make std use the edition 2024 prelude)
 - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools)
 - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved)

Failed merges:

 - #145324 (Rename and document `ONLY_HOSTS` in bootstrap)
 - #145372 (resolve: Miscellaneous cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 14, 2025
Rollup of 13 pull requests

Successful merges:

 - #122661 (Change the desugaring of `assert!` for better error output)
 - #142372 (Improve `--remap-path-prefix` documentation)
 - #143075 (compiler: Allow `extern "interrupt" fn() -> !`)
 - #145005 (strip prefix of temporary file names when it exceeds filesystem name length limit)
 - #145065 (resolve: Introduce `RibKind::Block`)
 - #145120 (llvm: Accept new LLVM lifetime format)
 - #145189 (Weekly `cargo update`)
 - #145261 (Improve tracing in bootstrap)
 - #145266 (Reduce some queries around associated items)
 - #145299 (doc test: fix mpsc.rs try_send doc test)
 - #145331 (Make std use the edition 2024 prelude)
 - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools)
 - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved)

Failed merges:

 - #145324 (Rename and document `ONLY_HOSTS` in bootstrap)
 - #145372 (resolve: Miscellaneous cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
@Zalathar
Copy link
Contributor

Investigating mysterious rollup failure: #145373 (comment)

@bors try jobs=i686-gnu-nopt-1

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 14, 2025
Reduce some queries around associated items

try-job: i686-gnu-nopt-1
bors added a commit that referenced this pull request Aug 14, 2025
Rollup of 13 pull requests

Successful merges:

 - #140434 (rustdoc: Allow multiple references to a single footnote)
 - #142372 (Improve `--remap-path-prefix` documentation)
 - #142741 (Fix unsoundness in some tests)
 - #144515 (Implement `ptr_cast_array`)
 - #144727 (Add tracing to resolve-related functions)
 - #144959 (fix(unicode-table-generator): fix duplicated unique indices)
 - #145179 (Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere)
 - #145250 (Add regression test for a former ICE involving helper attributes containing interpolated tokens)
 - #145266 (Reduce some queries around associated items)
 - #145299 (doc test: fix mpsc.rs try_send doc test)
 - #145323 (Port the `#[linkage]` attribute to the new attribute system)
 - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved)
 - #145372 (resolve: Miscellaneous cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-bors
Copy link

rust-bors bot commented Aug 14, 2025

☀️ Try build successful (CI)
Build commit: 48165e4 (48165e430c4c25d19014ace75a966f9a5c340ba5, parent: 2c1ac85679678dfe5cce7ea8037735b0349ceaf3)

@bors bors merged commit ad21c6d into rust-lang:master Aug 14, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 14, 2025
rust-timer added a commit that referenced this pull request Aug 14, 2025
Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkov

Reduce some queries around associated items
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 15, 2025
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#140434 (rustdoc: Allow multiple references to a single footnote)
 - rust-lang/rust#142372 (Improve `--remap-path-prefix` documentation)
 - rust-lang/rust#142741 (Fix unsoundness in some tests)
 - rust-lang/rust#144515 (Implement `ptr_cast_array`)
 - rust-lang/rust#144727 (Add tracing to resolve-related functions)
 - rust-lang/rust#144959 (fix(unicode-table-generator): fix duplicated unique indices)
 - rust-lang/rust#145179 (Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere)
 - rust-lang/rust#145250 (Add regression test for a former ICE involving helper attributes containing interpolated tokens)
 - rust-lang/rust#145266 (Reduce some queries around associated items)
 - rust-lang/rust#145299 (doc test: fix mpsc.rs try_send doc test)
 - rust-lang/rust#145323 (Port the `#[linkage]` attribute to the new attribute system)
 - rust-lang/rust#145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved)
 - rust-lang/rust#145372 (resolve: Miscellaneous cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
@camsteffen camsteffen deleted the reduce-queries branch August 15, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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.

7 participants