Skip to content

Try to make FieldDef smaller#157986

Draft
panstromek wants to merge 2 commits into
rust-lang:mainfrom
panstromek:make-field-def-smaller
Draft

Try to make FieldDef smaller#157986
panstromek wants to merge 2 commits into
rust-lang:mainfrom
panstromek:make-field-def-smaller

Conversation

@panstromek

Copy link
Copy Markdown
Contributor

Tries to mitigate the regression from #156824. Opening to try perf.

fixes #157003

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Jun 16, 2026
@panstromek

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 16, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 16, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-pre-stabilization failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/stats/input-stats.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stats/input-stats/input-stats.stderr`
diff of stderr:

33 ast-stats AssocItem                320 (NN.N%)             4            80
34 ast-stats - Fn                       160 (NN.N%)             2
35 ast-stats - Type                     160 (NN.N%)             2
- ast-stats FieldDef                 272 (NN.N%)             2           136
37 ast-stats Variant                  208 (NN.N%)             2           104
38 ast-stats Block                    192 (NN.N%)             6            32
+ ast-stats FieldDef                 176 (NN.N%)             2            88
39 ast-stats Stmt                     160 (NN.N%)             5            32
40 ast-stats - Let                       32 (NN.N%)             1
41 ast-stats - Semi                      32 (NN.N%)             1

57 ast-stats - AngleBracketed            40 (NN.N%)             1
58 ast-stats Crate                     40 (NN.N%)             1            40
59 ast-stats ----------------------------------------------------------------
- ast-stats Total                  7_624                   127
+ ast-stats Total                  7_528                   127
61 ast-stats ================================================================
62 hir-stats ================================================================
63 hir-stats HIR STATS: input_stats


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args stats/input-stats.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/ui/stats/input-stats.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stats/input-stats" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zinput-stats"
stdout: none
--- stderr -------------------------------
ast-stats ================================================================
ast-stats POST EXPANSION AST STATS: input_stats
ast-stats Name                Accumulated Size         Count     Item Size
ast-stats ----------------------------------------------------------------
ast-stats Item                   1_672 (22.2%)            11           152
ast-stats - Enum                     152 ( 2.0%)             1
ast-stats - ExternCrate              152 ( 2.0%)             1
ast-stats - ForeignMod               152 ( 2.0%)             1
ast-stats - Impl                     152 ( 2.0%)             1
ast-stats - Trait                    152 ( 2.0%)             1
ast-stats - Fn                       304 ( 4.0%)             2
ast-stats - Use                      608 ( 8.1%)             4
ast-stats Ty                       896 (11.9%)            14            64
ast-stats - Ptr                       64 ( 0.9%)             1
ast-stats - Ref                       64 ( 0.9%)             1
ast-stats - ImplicitSelf             128 ( 1.7%)             2
ast-stats - Path                     640 ( 8.5%)            10
ast-stats PathSegment              864 (11.5%)            36            24
ast-stats Expr                     648 ( 8.6%)             9            72
ast-stats - InlineAsm                 72 ( 1.0%)             1
ast-stats - Match                     72 ( 1.0%)             1
ast-stats - Path                      72 ( 1.0%)             1
ast-stats - Struct                    72 ( 1.0%)             1
ast-stats - Lit                      144 ( 1.9%)             2
ast-stats - Block                    216 ( 2.9%)             3
ast-stats Pat                      560 ( 7.4%)             7            80
ast-stats - Struct                    80 ( 1.1%)             1
ast-stats - Wild                      80 ( 1.1%)             1
ast-stats - Ident                    400 ( 5.3%)             5
ast-stats GenericParam             480 ( 6.4%)             5            96
ast-stats GenericBound             352 ( 4.7%)             4            88
ast-stats - Trait                    352 ( 4.7%)             4
ast-stats AssocItem                320 ( 4.3%)             4            80
ast-stats - Fn                       160 ( 2.1%)             2
ast-stats - Type                     160 ( 2.1%)             2
ast-stats Variant                  208 ( 2.8%)             2           104
ast-stats Block                    192 ( 2.6%)             6            32
ast-stats FieldDef                 176 ( 2.3%)             2            88
ast-stats Stmt                     160 ( 2.1%)             5            32
ast-stats - Let                       32 ( 0.4%)             1
ast-stats - Semi                      32 ( 0.4%)             1
ast-stats - Expr                      96 ( 1.3%)             3
ast-stats Param                    160 ( 2.1%)             4            40
ast-stats Attribute                128 ( 1.7%)             4            32
ast-stats - DocComment                32 ( 0.4%)             1
ast-stats - Normal                    96 ( 1.3%)             3
ast-stats InlineAsm                120 ( 1.6%)             1           120
ast-stats FnDecl                   120 ( 1.6%)             5            24
ast-stats Local                     96 ( 1.3%)             1            96
ast-stats Arm                       96 ( 1.3%)             2            48
ast-stats ForeignItem               80 ( 1.1%)             1            80
ast-stats - Fn                        80 ( 1.1%)             1
ast-stats WherePredicate            72 ( 1.0%)             1            72
ast-stats - BoundPredicate            72 ( 1.0%)             1
ast-stats ExprField                 48 ( 0.6%)             1            48
ast-stats GenericArgs               40 ( 0.5%)             1            40
ast-stats - AngleBracketed            40 ( 0.5%)             1
ast-stats Crate                     40 ( 0.5%)             1            40
ast-stats ----------------------------------------------------------------
ast-stats Total                  7_528                   127
ast-stats ================================================================
hir-stats ================================================================
hir-stats HIR STATS: input_stats
hir-stats Name                Accumulated Size         Count     Item Size
hir-stats ----------------------------------------------------------------
hir-stats PathSegment            1_776 (20.7%)            37            48
hir-stats Path                   1_040 (12.1%)            26            40
hir-stats Item                     968 (11.3%)            11            88
hir-stats - Enum                      88 ( 1.0%)             1
hir-stats - ExternCrate               88 ( 1.0%)             1
hir-stats - ForeignMod                88 ( 1.0%)             1
hir-stats - Impl                      88 ( 1.0%)             1
hir-stats - Trait                     88 ( 1.0%)             1
hir-stats - Fn                       176 ( 2.1%)             2
hir-stats - Use                      352 ( 4.1%)             4
hir-stats Expr                     768 ( 9.0%)            12            64
hir-stats - InlineAsm                 64 ( 0.7%)             1
hir-stats - Match                     64 ( 0.7%)             1
hir-stats - Path                      64 ( 0.7%)             1
hir-stats - Struct                    64 ( 0.7%)             1
hir-stats - Lit                      128 ( 1.5%)             2
hir-stats - Block                    384 ( 4.5%)             6
hir-stats Ty                       720 ( 8.4%)            15            48
hir-stats - Ptr                       48 ( 0.6%)             1
hir-stats - Ref                       48 ( 0.6%)             1
hir-stats - Path                     624 ( 7.3%)            13
hir-stats Generics                 560 ( 6.5%)            10            56
hir-stats Pat                      400 ( 4.7%)             5            80
hir-stats - Struct                    80 ( 0.9%)             1
hir-stats - Wild                      80 ( 0.9%)             1
hir-stats - Binding                  240 ( 2.8%)             3
hir-stats GenericParam             400 ( 4.7%)             5            80
hir-stats Block                    288 ( 3.4%)             6            48
hir-stats GenericBound             256 ( 3.0%)             4            64
hir-stats - Trait                    256 ( 3.0%)             4
hir-stats Attribute                160 ( 1.9%)             4            40
hir-stats Variant                  144 ( 1.7%)             2            72
hir-stats GenericArgs              144 ( 1.7%)             3            48
hir-stats FieldDef                 128 ( 1.5%)             2            64
hir-stats FnDecl                   120 ( 1.4%)             3            40
hir-stats Stmt                      96 ( 1.1%)             3            32
hir-stats - Expr                      32 ( 0.4%)             1
hir-stats - Let                       32 ( 0.4%)             1
hir-stats - Semi                      32 ( 0.4%)             1
hir-stats Arm                       80 ( 0.9%)             2            40
hir-stats WherePredicate            72 ( 0.8%)             3            24
hir-stats - BoundPredicate            72 ( 0.8%)             3
hir-stats InlineAsm                 72 ( 0.8%)             1            72
hir-stats Body                      72 ( 0.8%)             3            24
hir-stats Param                     64 ( 0.7%)             2            32
hir-stats Local                     64 ( 0.7%)             1            64
hir-stats GenericArg                64 ( 0.7%)             4            16
hir-stats - Type                      16 ( 0.2%)             1
hir-stats - Lifetime                  48 ( 0.6%)             3
hir-stats ExprField                 40 ( 0.5%)             1            40
hir-stats Mod                       32 ( 0.4%)             1            32
hir-stats Lifetime                  28 ( 0.3%)             1            28
hir-stats TraitItemId                8 ( 0.1%)             2             4
hir-stats ImplItemId                 8 ( 0.1%)             2             4
hir-stats ForeignItemId              4 ( 0.0%)             1             4
hir-stats ----------------------------------------------------------------
hir-stats Total                  8_576                   172
hir-stats ================================================================
------------------------------------------

---- [ui] tests/ui/stats/input-stats.rs stdout end ----

failures:

For more information how to resolve CI failures of this job, visit this link.

@rust-bors

rust-bors Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 289b567 (289b567a59d12dd1f7712d6ff110fbd73a56766d, parent: 89a99936d9e76a50e8df622e7242190841fd871b)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (289b567): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.4%, -0.2%] 10
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 7
All ❌✅ (primary) -0.2% [-0.4%, -0.2%] 10

Max RSS (memory usage)

Results (primary 6.4%, secondary 2.0%)

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

mean range count
Regressions ❌
(primary)
6.4% [2.4%, 10.6%] 3
Regressions ❌
(secondary)
5.9% [5.9%, 5.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 6.4% [2.4%, 10.6%] 3

Cycles

Results (primary 1.4%, secondary 4.9%)

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

mean range count
Regressions ❌
(primary)
1.4% [1.4%, 1.4%] 1
Regressions ❌
(secondary)
4.9% [2.8%, 7.6%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.4% [1.4%, 1.4%] 1

Binary size

Results (primary -0.0%)

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.0% [-0.0%, -0.0%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 4

Bootstrap: 522.035s -> 522.066s (0.01%)
Artifact size: 401.81 MiB -> 401.82 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Try to make FieldDef smaller

4 participants