Skip to content

Conversation

saethlin
Copy link
Member

On cfg(unix), Error::kind emits an enormous jump table that LLVM seems unable to optimize out. I don't really understand why, but see for yourself: https://godbolt.org/z/17hY496KG

This change lets us check for ErrorKind::Interrupted without going through a big match. I've checked the codegen locally, and it has the desired effect on the codegen for BufReader::read_exact.

@rustbot
Copy link
Collaborator

rustbot commented Aug 25, 2023

r? @cuviper

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added O-itron Operating System: ITRON O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows 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 Aug 25, 2023
@thomcc
Copy link
Member

thomcc commented Aug 25, 2023

Oh this is great stuff.

@bors r+ rollup=never

@bors
Copy link
Collaborator

bors commented Aug 25, 2023

📌 Commit 6ba95da3f05166e85a482b98a1c2fe2bc1f2d5ee has been approved by thomcc

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2023
@rust-log-analyzer

This comment has been minimized.

@saethlin
Copy link
Member Author

@bors r=thomcc rollup=never

@bors
Copy link
Collaborator

bors commented Aug 25, 2023

📌 Commit d3349bf746bc85b43e57022f954df999cd1ce4c6 has been approved by thomcc

It is now in the queue for this repository.

@saethlin
Copy link
Member Author

Once more, with feeling
@bors r=thomcc rollup=never

@bors
Copy link
Collaborator

bors commented Aug 25, 2023

📌 Commit 856e9bd7e240878be424eddbf709573e097557d5 has been approved by thomcc

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 26, 2023

⌛ Testing commit 856e9bd7e240878be424eddbf709573e097557d5 with merge e0e7bdebacb381de3e21642625b50a3923052a67...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Aug 26, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 26, 2023
@saethlin
Copy link
Member Author

And again
@bors r=thomcc rollup=never

@bors
Copy link
Collaborator

bors commented Aug 26, 2023

📌 Commit 1abaf40 has been approved by thomcc

It is now in the queue for this repository.

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

bors commented Aug 26, 2023

⌛ Testing commit 1abaf40 with merge 9334ec9...

@bors
Copy link
Collaborator

bors commented Aug 26, 2023

☀️ Test successful - checks-actions
Approved by: thomcc
Pushing 9334ec9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 26, 2023
@bors bors merged commit 9334ec9 into rust-lang:master Aug 26, 2023
@rustbot rustbot added this to the 1.74.0 milestone Aug 26, 2023
@saethlin saethlin deleted the is-interrupted branch August 26, 2023 05:33
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9334ec9): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.8%, -0.5%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.8%, 0.3%] 4

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
5.9% [1.0%, 8.3%] 3
Regressions ❌
(secondary)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
-5.0% [-5.0%, -5.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.2% [-5.0%, 8.3%] 4

Cycles

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

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.5%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.7%, -0.1%] 12
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.7%, 0.5%] 21

Bootstrap: 631.447s -> 631.911s (0.07%)
Artifact size: 315.65 MiB -> 315.57 MiB (-0.03%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 26, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 29, 2023
…thomcc

fix(sys/hermit): add is_interrupted

rust-lang#115228 broke compilation for Hermit by not adding a Hermit implementation of is_interrupted.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 31, 2023
fix(sys/hermit): add is_interrupted

rust-lang/rust#115228 broke compilation for Hermit by not adding a Hermit implementation of is_interrupted.
fmease added a commit to fmease/rust that referenced this pull request Sep 2, 2023
…upted, r=cuviper

kmc-solid: Fix `is_interrupted`

Follow-up to rust-lang#115228. Fixes a build error in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

```
error[E0603]: function `is_interrupted` is private
  --> library\std\src\sys\solid\mod.rs:77:12
   |
77 |     error::is_interrupted(code)
   |            ^^^^^^^^^^^^^^ private function
   |
note: the function `is_interrupted` is defined here
  --> library\std\src\sys\solid\error.rs:35:1
   |
35 | fn is_interrupted(er: abi::ER) -> bool {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
fmease added a commit to fmease/rust that referenced this pull request Sep 2, 2023
…upted, r=cuviper

kmc-solid: Fix `is_interrupted`

Follow-up to rust-lang#115228. Fixes a build error in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

```
error[E0603]: function `is_interrupted` is private
  --> library\std\src\sys\solid\mod.rs:77:12
   |
77 |     error::is_interrupted(code)
   |            ^^^^^^^^^^^^^^ private function
   |
note: the function `is_interrupted` is defined here
  --> library\std\src\sys\solid\error.rs:35:1
   |
35 | fn is_interrupted(er: abi::ER) -> bool {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 2, 2023
…upted, r=cuviper

kmc-solid: Fix `is_interrupted`

Follow-up to rust-lang#115228. Fixes a build error in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

```
error[E0603]: function `is_interrupted` is private
  --> library\std\src\sys\solid\mod.rs:77:12
   |
77 |     error::is_interrupted(code)
   |            ^^^^^^^^^^^^^^ private function
   |
note: the function `is_interrupted` is defined here
  --> library\std\src\sys\solid\error.rs:35:1
   |
35 | fn is_interrupted(er: abi::ER) -> bool {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
@saethlin
Copy link
Member Author

saethlin commented Sep 2, 2023

Tiny regression, significance factor 1.63, looks spurious to me.
@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 2, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 3, 2023
Use std::io::Error::is_interrupted everywhere

In rust-lang#115228 I introduced this helper and started using it, this PR uses it to replace all applicable uses of `std::io::Error::kind`. The justification is the same; for whatever reason LLVM totally flops optimizing `Error::kind` so it's nice to use it less.

FYI ``@mkroening`` I swear the hermit changes look good, but I was so sure about the previous PR.
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. O-itron Operating System: ITRON O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants