Skip to content

[EXPERIMENT] Don't box Exprs in ThinVecs - #159052

Closed
nnethercote wants to merge 1 commit into
rust-lang:mainfrom
nnethercote:unbox-Expr-in-ThinVec
Closed

nnethercote wants to merge 1 commit into
rust-lang:mainfrom
nnethercote:unbox-Expr-in-ThinVec

Conversation

@nnethercote

Copy link
Copy Markdown
Contributor

No description provided.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 Jul 10, 2026
@nnethercote

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 Jul 10, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 10, 2026
[EXPERIMENT] Don't box `Expr`s in `ThinVec`s
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
error[E0308]: mismatched types
    --> compiler/rustc_parse/src/parser/tests.rs:2239:5
     |
2238 | fn string_to_expr(source_str: String) -> Box<ast::Expr> {
     |                                          -------------- expected `std::boxed::Box<rustc_ast::Expr>` because of return type
2239 |     with_error_checking_parse(source_str, &ParseSess::new(), |p| p.parse_expr())
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<Expr>`, found `Expr`
     |
     = note: expected struct `std::boxed::Box<rustc_ast::Expr>`
                found struct `rustc_ast::Expr`
     = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
help: store this in the heap by calling `Box::new`
     |
2239 |     Box::new(with_error_checking_parse(source_str, &ParseSess::new(), |p| p.parse_expr()))
     |     +++++++++                                                                            +

error[E0308]: mismatched types
    --> compiler/rustc_parse/src/parser/tests.rs:2510:9
     |
2509 |       ) -> PResult<'_, Box<ast::Expr>> {
     |            --------------------------- expected `Result<std::boxed::Box<rustc_ast::Expr>, Diag<'_>>` because of return type
2510 | /         unwrap_or_emit_fatal(new_parser_from_source_str(psess, name, source, StripTokens::Nothing))
2511 | |             .parse_expr()
     | |_________________________^ expected `Result<Box<Expr>, Diag<'_>>`, found `Result<Expr, Diag<'_>>`
     |
     = note: expected enum `Result<std::boxed::Box<rustc_ast::Expr>, Diag<'_>>`
                found enum `Result<rustc_ast::Expr, Diag<'_>>`

[RUSTC-TIMING] rustc_mir_dataflow test:true 4.145

@rust-bors

rust-bors Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 4353935 (435393545f5334c04c9ddff34f626499a2700a09)
Base parent: d465559 (d465559281ebfb5b586913285f4d40f9b518b729)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (4353935): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

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.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@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.3% [0.1%, 1.2%] 72
Regressions ❌
(secondary)
0.9% [0.0%, 3.8%] 68
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.3%, -0.0%] 4
All ❌✅ (primary) 0.3% [0.1%, 1.2%] 72

Max RSS (memory usage)

Results (primary -1.9%, secondary 3.1%)

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)
3.7% [1.3%, 11.4%] 18
Improvements ✅
(primary)
-1.9% [-3.8%, -0.7%] 3
Improvements ✅
(secondary)
-7.2% [-7.2%, -7.2%] 1
All ❌✅ (primary) -1.9% [-3.8%, -0.7%] 3

Cycles

Results (primary 4.1%, secondary 2.5%)

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

mean range count
Regressions ❌
(primary)
4.1% [1.7%, 8.4%] 16
Regressions ❌
(secondary)
6.5% [1.7%, 18.4%] 36
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.6% [-10.9%, -1.7%] 18
All ❌✅ (primary) 4.1% [1.7%, 8.4%] 16

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 490.768s -> 491.809s (0.21%)
Artifact size: 389.74 MiB -> 389.01 MiB (-0.19%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 10, 2026
@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 Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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.

4 participants