Repository navigation
Minor optimizations around macro parsing - #164540
Conversation
It does not have any use, and it is a no-op we have to process on the hot path of macro parsing.
The parsing code is much hotter than `compute_locs()`, so perform the match over there. This might mildly change the debug representation of computed `[MatcherLoc]`s, but it's probably worthwhile for perf.
|
Thanks for the pull request, and welcome! The Rust Project has assigned @nnethercote (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. |
|
@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.
Minor optimizations around macro parsing
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (9d5633d): comparison URL. Overall result: ✅ 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.5%, secondary 1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.4%)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: 489.811s -> 492.784s (0.61%) |
|
@bors r+ rollup |
Minor optimizations around macro parsing Picked out some standalone commits from my macro matching optimization work. These are independent small optimizations that should add up to a tiny but measurable perf win. Part of rust-lang#159951. Best reviewed commit-by-commit. No LLMs used. r? @nnethercote
…uwer Rollup of 15 pull requests Successful merges: - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - #163338 (MIR move elimination [4/6]: MoveElimination) - #163701 (add ReadDir::dir to get the directory handle of the underlying directory) - #164488 (Don't try to skip anything in `Skip::advance_by(0)`) - #164611 (Improve bit permutation codegen) - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - #162668 (document that `!` does bitwise and logical negation) - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - #164509 (layout invariant: turn delayed bug back into proper assertion) - #164540 (Minor optimizations around macro parsing) - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - #164595 (Allow attributes in function trait parameters) - #164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
Minor optimizations around macro parsing Picked out some standalone commits from my macro matching optimization work. These are independent small optimizations that should add up to a tiny but measurable perf win. Part of rust-lang#159951. Best reviewed commit-by-commit. No LLMs used. r? @nnethercote
…uwer Rollup of 14 pull requests Successful merges: - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - #163701 (add ReadDir::dir to get the directory handle of the underlying directory) - #164488 (Don't try to skip anything in `Skip::advance_by(0)`) - #164611 (Improve bit permutation codegen) - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - #162668 (document that `!` does bitwise and logical negation) - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - #164509 (layout invariant: turn delayed bug back into proper assertion) - #164540 (Minor optimizations around macro parsing) - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - #164595 (Allow attributes in function trait parameters) - #164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
…uwer Rollup of 14 pull requests Successful merges: - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - #163701 (add ReadDir::dir to get the directory handle of the underlying directory) - #164488 (Don't try to skip anything in `Skip::advance_by(0)`) - #164611 (Improve bit permutation codegen) - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - #162668 (document that `!` does bitwise and logical negation) - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - #164509 (layout invariant: turn delayed bug back into proper assertion) - #164540 (Minor optimizations around macro parsing) - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - #164595 (Allow attributes in function trait parameters) - #164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
Minor optimizations around macro parsing Picked out some standalone commits from my macro matching optimization work. These are independent small optimizations that should add up to a tiny but measurable perf win. Part of rust-lang#159951. Best reviewed commit-by-commit. No LLMs used. r? @nnethercote
…uwer Rollup of 19 pull requests Successful merges: - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - #163668 (Remap syntax contexts and expansion ids for det. metadata encoding) - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd) - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - #163317 (Stop useless caching of post-LTO artifact caching for fat LTO) - #163701 (add ReadDir::dir to get the directory handle of the underlying directory) - #164488 (Don't try to skip anything in `Skip::advance_by(0)`) - #164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism) - #164611 (Improve bit permutation codegen) - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - #162668 (document that `!` does bitwise and logical negation) - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - #164509 (layout invariant: turn delayed bug back into proper assertion) - #164540 (Minor optimizations around macro parsing) - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - #164595 (Allow attributes in function trait parameters) - #164641 (Stabilize `slice_split_once`) - #164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
Rollup of 20 pull requests Successful merges: - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - #163668 (Remap syntax contexts and expansion ids for det. metadata encoding) - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - #163317 (Stop useless caching of post-LTO artifact caching for fat LTO) - #163701 (add ReadDir::dir to get the directory handle of the underlying directory) - #164488 (Don't try to skip anything in `Skip::advance_by(0)`) - #164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism) - #164611 (Improve bit permutation codegen) - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - #162668 (document that `!` does bitwise and logical negation) - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - #164509 (layout invariant: turn delayed bug back into proper assertion) - #164540 (Minor optimizations around macro parsing) - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - #164595 (Allow attributes in function trait parameters) - #164616 (Add test for VecDeque with a custom allocator) - #164629 (arch::breakpoint: avoid confusing 'equivalent' terminology) - #164641 (Stabilize `slice_split_once`) - #164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
Rollup merge of #164540 - bal-e:mini-macro-opts, r=nnethercote Minor optimizations around macro parsing Picked out some standalone commits from my macro matching optimization work. These are independent small optimizations that should add up to a tiny but measurable perf win. Part of #159951. Best reviewed commit-by-commit. No LLMs used. r? @nnethercote
Rollup of 20 pull requests Successful merges: - rust-lang/rust#163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - rust-lang/rust#163668 (Remap syntax contexts and expansion ids for det. metadata encoding) - rust-lang/rust#163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - rust-lang/rust#163317 (Stop useless caching of post-LTO artifact caching for fat LTO) - rust-lang/rust#163701 (add ReadDir::dir to get the directory handle of the underlying directory) - rust-lang/rust#164488 (Don't try to skip anything in `Skip::advance_by(0)`) - rust-lang/rust#164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism) - rust-lang/rust#164611 (Improve bit permutation codegen) - rust-lang/rust#164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - rust-lang/rust#148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - rust-lang/rust#162668 (document that `!` does bitwise and logical negation) - rust-lang/rust#164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - rust-lang/rust#164509 (layout invariant: turn delayed bug back into proper assertion) - rust-lang/rust#164540 (Minor optimizations around macro parsing) - rust-lang/rust#164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - rust-lang/rust#164595 (Allow attributes in function trait parameters) - rust-lang/rust#164616 (Add test for VecDeque with a custom allocator) - rust-lang/rust#164629 (arch::breakpoint: avoid confusing 'equivalent' terminology) - rust-lang/rust#164641 (Stabilize `slice_split_once`) - rust-lang/rust#164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
Rollup of 20 pull requests Successful merges: - rust-lang/rust#163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests) - rust-lang/rust#163668 (Remap syntax contexts and expansion ids for det. metadata encoding) - rust-lang/rust#163104 ([debuginfo] Emit `usize` and `isize` as typedefs) - rust-lang/rust#163317 (Stop useless caching of post-LTO artifact caching for fat LTO) - rust-lang/rust#163701 (add ReadDir::dir to get the directory handle of the underlying directory) - rust-lang/rust#164488 (Don't try to skip anything in `Skip::advance_by(0)`) - rust-lang/rust#164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism) - rust-lang/rust#164611 (Improve bit permutation codegen) - rust-lang/rust#164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`) - rust-lang/rust#148842 (Avoid incorrect lifetime suggestion involving `sym::anon`) - rust-lang/rust#162668 (document that `!` does bitwise and logical negation) - rust-lang/rust#164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons) - rust-lang/rust#164509 (layout invariant: turn delayed bug back into proper assertion) - rust-lang/rust#164540 (Minor optimizations around macro parsing) - rust-lang/rust#164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules) - rust-lang/rust#164595 (Allow attributes in function trait parameters) - rust-lang/rust#164616 (Add test for VecDeque with a custom allocator) - rust-lang/rust#164629 (arch::breakpoint: avoid confusing 'equivalent' terminology) - rust-lang/rust#164641 (Stabilize `slice_split_once`) - rust-lang/rust#164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
Picked out some standalone commits from my macro matching optimization work. These are independent small optimizations that should add up to a tiny but measurable perf win.
Part of #159951. Best reviewed commit-by-commit. No LLMs used.
r? @nnethercote