Skip to content

perf: skip the HIR parent walk in is_in_test_function when there are no test items#17224

Merged
llogiq merged 1 commit into
rust-lang:masterfrom
xmakro:perf/is-in-test-empty-fastpath
Jun 30, 2026
Merged

perf: skip the HIR parent walk in is_in_test_function when there are no test items#17224
llogiq merged 1 commit into
rust-lang:masterfrom
xmakro:perf/is-in-test-empty-fastpath

Conversation

@xmakro

@xmakro xmakro commented Jun 13, 2026

Copy link
Copy Markdown
Contributor
crate instructions base instructions new delta
cargo-0.80.0 (lib) 29,893,023,355 29,833,523,078 -0.199%
cargo-0.80.0 (bin) 1,631,899,838 1,630,357,438 -0.094%
serde-1.0.204 7,203,744,118 7,190,517,132 -0.184%
wasmi-0.35.0 16,147,485,674 16,136,003,333 -0.071%
ryu-1.0.18 271,114,526 270,956,632 -0.058%

changelog: none

@xmakro

xmakro commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

r? @samueltardieu

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

rustbot commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

r? @llogiq

rustbot has assigned @llogiq.
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

@samueltardieu

Copy link
Copy Markdown
Member

r? clippy

@rustbot rustbot assigned dswij and unassigned samueltardieu and llogiq Jun 13, 2026
@llogiq

llogiq commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

r? @llogiq

Sorry for the delay, I'm on it.

@rustbot rustbot assigned llogiq and unassigned dswij Jun 30, 2026

@llogiq llogiq 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.

Looks good to me. Thank you.

View changes since this review

Comment thread clippy_utils/src/lib.rs
&& let ItemKind::Fn { ident, .. } = item.kind
{
// Note that we have sorted the item names in the visitor,
// so the binary_search gets the same as `contains`, but faster.

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.

That's underestimating the efficiency of a linear search. At least if there are only a few test functions in the module, linear search can actually be faster. Not that it matters, in those cases both are sufficiently speedy.

@llogiq
llogiq added this pull request to the merge queue Jun 30, 2026
Merged via the queue into rust-lang:master with commit c04aa63 Jun 30, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 30, 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.

5 participants