-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
All attributes, both using the old and new parsing infrastructure are currently parsed (at least) twice
- To do a few checks on the attribute, here: https://github.com/rust-lang/rust/blob/cccf075eba88363269e8589ebb8d40874cc542d8/compiler/rustc_parse/src/validate_attr.rs#L34C19-L34C29
- To lower the attribute, here:
pub fn parse_attribute_list(
#[cfg]
was one of the only attributes that was only parsed once. When we ported #[cfg] the the new parsing infrastructure (#143460), we sadly had to also parse it twice, losing around ~0.2% performance on some benchmarks.
This suggests that if we can merge these checks into the new attribute parser we can gain quite a bit of performance. We should do this.
jdonszelmann and Kobzoljdonszelmann
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.