Skip to content

Add #[inline] annotation to functions moved out of std::io#159313

Open
bushrat011899 wants to merge 1 commit into
rust-lang:mainfrom
bushrat011899:io_inline
Open

Add #[inline] annotation to functions moved out of std::io#159313
bushrat011899 wants to merge 1 commit into
rust-lang:mainfrom
bushrat011899:io_inline

Conversation

@bushrat011899

Copy link
Copy Markdown
Contributor

Description

  • Attempts to resolve compilation time regressions noted here.

Solution

Added #[inline] to public functions in alloc::io and core::io with total disregard to rhyme or reason. Might make things better, might make them worse, let's find out!


Notes

  • No AI tooling of any kind was used during the creation of this bodge PR.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 15, 2026
@rustbot

rustbot commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

r? @clarfonthey

rustbot has assigned @clarfonthey.
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: libs
  • libs expanded to 12 candidates
  • Random selection from 6 candidates

@bushrat011899

Copy link
Copy Markdown
Contributor Author

@JonathanBrouwer and/or @clarfonthey could we try a perf-run on this PR? I'm curious if this makes things better or worse for the core::io migration regressions.

@clarfonthey

clarfonthey commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

Side note: very amused that this randomly chose me as the reviewer even though you didn't specify manually.

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 15, 2026
Add `#[inline]` annotation to functions moved out of `std::io`
@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 71248b2 (71248b2ef0eb27d87ea455b1bdc956e55f92e04c)
Base parent: 38a0576 (38a0576951fb5f7209c892b030f40ac166ae86b4)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (71248b2): 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 rustc-perf
@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)
1.2% [1.0%, 1.4%] 2
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 2
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-1.0%, 1.4%] 3

Max RSS (memory usage)

Results (primary -2.2%, secondary 4.7%)

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

mean range count
Regressions ❌
(primary)
0.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
4.7% [4.2%, 5.2%] 2
Improvements ✅
(primary)
-3.3% [-3.9%, -2.2%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.2% [-3.9%, 0.9%] 4

Cycles

Results (primary 2.8%, secondary -1.9%)

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

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.4% [-3.5%, -3.2%] 3
All ❌✅ (primary) 2.8% [2.8%, 2.8%] 1

Binary size

Results (primary 0.2%, secondary 0.2%)

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

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 1.6%] 6
Regressions ❌
(secondary)
0.2% [0.0%, 0.3%] 2
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-0.5%, 1.6%] 7

Bootstrap: 489.951s -> 488.986s (-0.20%)
Artifact size: 389.41 MiB -> 390.00 MiB (0.15%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 15, 2026
@bushrat011899

bushrat011899 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Ok so the most notable result I can see is the improvement to cargo, which I believe nullifies (most of) the negatives that came from moving Write. I'll need to double check, but I think ripgrep's regression here is actually the inverse of an improvement from the Error move.

Either way, I think it's clear that some of these functions probably shouldn't be inline. Now to work out which 🙃

EDIT:

Actually never mind ripgrep has just gotten worse with every migration. This PR reverts the worst regressions from Write, but adds doesn't help Error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library 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