Refactor proc_macro_decls_static#158119
Conversation
proc_macro_decls_static
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
… r=<try> Refactor `proc_macro_decls_static`
| providers.queries.early_lint_checks = early_lint_checks; | ||
| providers.queries.env_var_os = env_var_os; | ||
| providers.queries.proc_macro_decls_static = | ||
| |tcx, _| tcx.hir_crate_items(()).rustc_proc_macro_decls(); |
There was a problem hiding this comment.
Does it need to be a query now when it just reads a field in ModuleItems?
There was a problem hiding this comment.
It can be seen as a projection query over hir_crate_items, so if anything else changes in hir_crate_items and we will use tcx.hir_crate_items(()).rustc_proc_macro_decls() instead of projection query then we would invalidate calling query as hir_crate_items will be red. proc_macro_decls_static it is not used in many places, but I can't predict how it will affect perf if we remove it.
There was a problem hiding this comment.
But all accessors (free_items, trait_items, ...) of hir_crate_items are regular methods, not queries, maybe they were queries in the past and were made regular methods for perf reasons, or maybe we can try to make them all queries and see what happens.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (4efc489): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.2%, secondary 5.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.0%, secondary 3.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 481.812s -> 481.916s (0.02%) |
This comment has been minimized.
This comment has been minimized.
66723f1 to
3d19869
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Given insignificant perf changes I returned |
|
@bors r+ rollup |
…efactoring, r=petrochenkov Refactor `proc_macro_decls_static` During experiments in rust-lang#158024 I've noticed that we iterate over all `hir_free_items` and find `RustcProcMacroDecls` on each of them for rewrite of a single `Option` which is the result of the query. In this PR: - The seach for `RustcProcMacroDecls` attribute is moved into `hir_crate_items` and result is cached in `ModuleItems`, now we do not find `RustcProcMacroDecls` for each free item, we stop when it is found, - ~`self.crate_collector` is replaced with generic const `CRATE_COLLECTOR`, maybe will give perf. improvements.~ r? @petrochenkov
…efactoring, r=petrochenkov Refactor `proc_macro_decls_static` During experiments in rust-lang#158024 I've noticed that we iterate over all `hir_free_items` and find `RustcProcMacroDecls` on each of them for rewrite of a single `Option` which is the result of the query. In this PR: - The seach for `RustcProcMacroDecls` attribute is moved into `hir_crate_items` and result is cached in `ModuleItems`, now we do not find `RustcProcMacroDecls` for each free item, we stop when it is found, - ~`self.crate_collector` is replaced with generic const `CRATE_COLLECTOR`, maybe will give perf. improvements.~ r? @petrochenkov
…efactoring, r=petrochenkov Refactor `proc_macro_decls_static` During experiments in rust-lang#158024 I've noticed that we iterate over all `hir_free_items` and find `RustcProcMacroDecls` on each of them for rewrite of a single `Option` which is the result of the query. In this PR: - The seach for `RustcProcMacroDecls` attribute is moved into `hir_crate_items` and result is cached in `ModuleItems`, now we do not find `RustcProcMacroDecls` for each free item, we stop when it is found, - ~`self.crate_collector` is replaced with generic const `CRATE_COLLECTOR`, maybe will give perf. improvements.~ r? @petrochenkov
…uwer Rollup of 5 pull requests Successful merges: - #155811 (Include AtomicU128/AtomicI128 in docs for any target) - #158242 (Fix linking for wasm with crate metadata included) - #158119 (Refactor `proc_macro_decls_static`) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.)
…efactoring, r=petrochenkov Refactor `proc_macro_decls_static` During experiments in rust-lang#158024 I've noticed that we iterate over all `hir_free_items` and find `RustcProcMacroDecls` on each of them for rewrite of a single `Option` which is the result of the query. In this PR: - The seach for `RustcProcMacroDecls` attribute is moved into `hir_crate_items` and result is cached in `ModuleItems`, now we do not find `RustcProcMacroDecls` for each free item, we stop when it is found, - ~`self.crate_collector` is replaced with generic const `CRATE_COLLECTOR`, maybe will give perf. improvements.~ r? @petrochenkov
…uwer Rollup of 7 pull requests Successful merges: - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158242 (Fix linking for wasm with crate metadata included) - #158119 (Refactor `proc_macro_decls_static`) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
Rollup merge of #158119 - aerooneqq:rustc-proc-macro-decls-refactoring, r=petrochenkov Refactor `proc_macro_decls_static` During experiments in #158024 I've noticed that we iterate over all `hir_free_items` and find `RustcProcMacroDecls` on each of them for rewrite of a single `Option` which is the result of the query. In this PR: - The seach for `RustcProcMacroDecls` attribute is moved into `hir_crate_items` and result is cached in `ModuleItems`, now we do not find `RustcProcMacroDecls` for each free item, we stop when it is found, - ~`self.crate_collector` is replaced with generic const `CRATE_COLLECTOR`, maybe will give perf. improvements.~ r? @petrochenkov
During experiments in #158024 I've noticed that we iterate over all
hir_free_itemsand findRustcProcMacroDeclson each of them for rewrite of a singleOptionwhich is the result of the query.In this PR:
RustcProcMacroDeclsattribute is moved intohir_crate_itemsand result is cached inModuleItems, now we do not findRustcProcMacroDeclsfor each free item, we stop when it is found,self.crate_collectoris replaced with generic constCRATE_COLLECTOR, maybe will give perf. improvements.r? @petrochenkov