Skip to content

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Aug 25, 2025

Discussed on Zulip (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/rustc.20uses.20silly.20amount.20of.20syscalls.20for.20file.20IO/with/536015625.

Do not open/close each source file twice when reading it. We still stat it twice though.

@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. labels Aug 25, 2025
@Kobzol
Copy link
Member Author

Kobzol commented Aug 25, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 25, 2025
Slightly optimize reading of source files
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 25, 2025
@rust-bors

This comment has been minimized.

@Kobzol Kobzol force-pushed the optimize-file-read branch from 66f96d6 to e88d8b0 Compare August 25, 2025 13:32
@Kobzol
Copy link
Member Author

Kobzol commented Aug 25, 2025

@bors try

rust-bors bot added a commit that referenced this pull request Aug 25, 2025
Slightly optimize reading of source files
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 25, 2025

☀️ Try build successful (CI)
Build commit: 95ae8eb (95ae8eb3c562954cebf4450e01020a53bc83a274, parent: ee361e8fca1c30e13e7a31cc82b64c045339d3a8)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (95ae8eb): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in 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
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

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

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 467.59s -> 467.992s (0.09%)
Artifact size: 378.37 MiB -> 378.32 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 25, 2025
@Kobzol Kobzol marked this pull request as ready for review August 25, 2025 17:06
@rustbot
Copy link
Collaborator

rustbot commented Aug 25, 2025

r? @fee1-dead

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 25, 2025
@Kobzol
Copy link
Member Author

Kobzol commented Aug 25, 2025

No regressions, and the change is rather miniscule, so could be worth to land it.

I took a look at the other inefficiencies (first we check if file exists and only then we load it), but it wasn't trivial to modify it without regressing error messages.

r? @the8472

@rustbot rustbot assigned the8472 and unassigned fee1-dead Aug 25, 2025
@Kobzol Kobzol force-pushed the optimize-file-read branch from e88d8b0 to 3145c06 Compare August 25, 2025 18:40
@the8472
Copy link
Member

the8472 commented Aug 25, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 25, 2025

📌 Commit 3145c06 has been approved by the8472

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2025
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 25, 2025
@bors
Copy link
Collaborator

bors commented Aug 26, 2025

⌛ Testing commit 3145c06 with merge ace9a74...

@bors
Copy link
Collaborator

bors commented Aug 26, 2025

☀️ Test successful - checks-actions
Approved by: the8472
Pushing ace9a74 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 26, 2025
@bors bors merged commit ace9a74 into rust-lang:master Aug 26, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 26, 2025
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing d327d65 (parent) -> ace9a74 (this PR)

Test differences

Show 4 test diffs

4 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard ace9a74442aec13c75532d34e15d97428056866d --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-android: 2086.8s -> 2571.4s (23.2%)
  2. x86_64-gnu-nopt: 7385.7s -> 8765.9s (18.7%)
  3. dist-aarch64-apple: 5533.4s -> 6291.5s (13.7%)
  4. x86_64-rust-for-linux: 2706.6s -> 3024.0s (11.7%)
  5. dist-x86_64-apple: 7762.4s -> 6950.2s (-10.5%)
  6. aarch64-gnu: 7672.0s -> 6912.7s (-9.9%)
  7. aarch64-msvc-2: 4773.6s -> 5245.3s (9.9%)
  8. dist-apple-various: 4860.2s -> 5306.9s (9.2%)
  9. aarch64-gnu-llvm-19-2: 2422.0s -> 2586.0s (6.8%)
  10. i686-gnu-1: 8082.8s -> 8599.4s (6.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@Kobzol Kobzol deleted the optimize-file-read branch August 26, 2025 07:47
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ace9a74): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -2.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.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
-2.9% [-5.2%, -0.6%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.9% [-5.2%, -0.6%] 2

Cycles

Results (secondary 1.5%)

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

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 466.213s -> 468.198s (0.43%)
Artifact size: 378.38 MiB -> 378.40 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants