Skip to content

perf: skip the boxed_local walk for functions without a Box parameter#17168

Merged
Jarcho merged 1 commit into
rust-lang:masterfrom
xmakro:perf/boxed-local-skip-walk
Jun 6, 2026
Merged

perf: skip the boxed_local walk for functions without a Box parameter#17168
Jarcho merged 1 commit into
rust-lang:masterfrom
xmakro:perf/boxed-local-skip-walk

Conversation

@xmakro

@xmakro xmakro commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

The boxed_local lint ran an ExprUseVisitor borrow/move walk over every function, method and closure body, even though it can only ever flag a parameter whose type is a non-trait Box<T>. This checks the parameter types up front and skips the walk when none qualifies.

Instruction counts for clippy-driver (clippy only, not cargo check) with deps cached, under valgrind --tool=callgrind, master vs this change:

crate master this PR change
syn 2,371,880,878 2,346,059,095 -1.09%
rayon 2,329,240,661 2,304,827,405 -1.05%
tokio 427,354,679 423,170,294 -0.98%
regex 906,303,399 900,393,899 -0.65%
cxx 691,316,557 687,803,641 -0.51%
serde 3,388,608,388 3,376,064,002 -0.37%

changelog: none

@xmakro xmakro marked this pull request as ready for review June 6, 2026 03:40
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 6, 2026
@rustbot

rustbot commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 8 candidates
  • 8 candidates expanded to 8 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@Jarcho

Jarcho commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

While you're changing this can you just initialize the delegate with the candidate arguments directly rather than the current awkward initialization of the candidates via the mutate method.

@xmakro xmakro force-pushed the perf/boxed-local-skip-walk branch from 73f684e to bc274fe Compare June 6, 2026 17:52

@Jarcho Jarcho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jarcho Jarcho added this pull request to the merge queue Jun 6, 2026
Merged via the queue into rust-lang:master with commit 05a1ffe Jun 6, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants