-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Lazily evaluate EvalErrorKind::*.into() calls. #50051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
Please do not update the |
|
@bors try |
|
⌛ Trying commit 201e9ad35aceeada2cccf6aaf6f1a3287ec6c053 with merge 0940946610b2557197284588f22f39097b9b7010... |
|
💔 Test failed - status-travis |
|
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
eval_context.rs calls `ok_or` in multiple places with an eagerly
evaluated `EvalErrorKind::*.into()` argument, which calls
EvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.
This patch changes the `ok_or` calls into `ok_or_else`, thus avoiding
the evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.
|
I updated the patch to remove the unintentional submodule changes. Sometimes that happens to me when I update my repo, I don't understand why. |
|
📌 Commit 5070dea has been approved by |
|
Jup, I already saw it, and I fully agree this is good. I really am bad at writing code without clippy looking over my shoulder :( |
Lazily evaluate EvalErrorKind::*.into() calls.
eval_context.rs calls `ok_or` in multiple places with an eagerly
evaluated `EvalErrorKind::*.into()` argument, which calls
EvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.
This patch changes the `ok_or` calls into `ok_or_else`, thus avoiding
the evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.
Output from rustc-perf, comparing stage 2 builds with jemalloc disabled:
<details>
```
coercions
avg: -1.8% min: -6.0% max: -0.0%
helloworld-opt
avg: -3.7% min: -4.0% max: -3.4%
helloworld
avg: -3.7% min: -3.9% max: -3.5%
parser
avg: -3.5% min: -3.9% max: -3.1%
unify-linearly-opt
avg: -3.2% min: -3.8% max: -2.8%
unify-linearly
avg: -3.2% min: -3.7% max: -2.8%
parser-opt
avg: -3.2% min: -3.6% max: -2.8%
clap-rs
avg: -0.9% min: -3.6% max: 0.1%
encoding
avg: -1.9% min: -3.0% max: -1.2%
clap-rs-opt
avg: -0.8% min: -2.7% max: -0.1%
helloworld-check
avg: -1.9% min: -2.2% max: -1.7%
deeply-nested-check
avg: -1.4% min: -2.1% max: -0.9%
issue-46449-opt
avg: -0.7% min: -2.0% max: -0.3%
unify-linearly-check
avg: -1.5% min: -1.9% max: -1.2%
issue-46449
avg: -1.0% min: -1.8% max: -0.8%
deeply-nested-opt
avg: -0.7% min: -1.7% max: -0.2%
deeply-nested
avg: -1.0% min: -1.6% max: -0.6%
parser-check
avg: -1.3% min: -1.6% max: -0.8%
encoding-check
avg: -1.5% min: -1.6% max: -1.2%
tuple-stress
avg: -0.9% min: -1.5% max: 0.0%
tuple-stress-opt
avg: -1.0% min: -1.5% max: -0.3%
issue-46449-check
avg: -1.3% min: -1.4% max: -1.0%
encoding-opt
avg: -1.1% min: -1.2% max: -0.9%
regression-31157
avg: -0.7% min: -1.2% max: -0.2%
regression-31157-check
avg: -0.8% min: -1.2% max: -0.5%
futures-check
avg: -0.8% min: -1.2% max: -0.4%
unused-warnings-opt
avg: -1.0% min: -1.2% max: -0.9%
unused-warnings
avg: -1.0% min: -1.1% max: -0.9%
coercions-opt
avg: -0.6% min: -1.0% max: -0.2%
inflate-check
avg: -0.4% min: -0.9% max: -0.1%
regex-check
avg: -0.8% min: -0.9% max: -0.5%
piston-image-check
avg: -0.8% min: -0.9% max: -0.8%
deep-vector
avg: -0.3% min: -0.9% max: 0.1%
futures
avg: -0.5% min: -0.8% max: -0.2%
futures-opt
avg: -0.5% min: -0.7% max: -0.1%
html5ever
avg: -0.6% min: -0.7% max: -0.4%
tokio-webpush-simple-check
avg: -0.2% min: -0.7% max: 0.1%
piston-image-opt
avg: -0.3% min: -0.7% max: -0.1%
regex
avg: -0.4% min: -0.7% max: -0.1%
piston-image
avg: -0.4% min: -0.7% max: -0.2%
regex-opt
avg: -0.3% min: -0.7% max: 0.1%
tokio-webpush-simple-opt
avg: -0.2% min: -0.6% max: 0.0%
coercions-check
avg: -0.3% min: -0.6% max: -0.1%
hyper
avg: -0.4% min: -0.6% max: -0.2%
syn-opt
avg: -0.3% min: -0.6% max: -0.0%
hyper-check
avg: -0.5% min: -0.6% max: -0.3%
syn-check
avg: -0.4% min: -0.5% max: -0.2%
hyper-opt
avg: -0.3% min: -0.5% max: -0.1%
html5ever-opt
avg: -0.3% min: -0.5% max: -0.2%
syn
avg: -0.2% min: -0.4% max: -0.1%
deep-vector-opt
avg: -0.2% min: -0.4% max: 0.1%
tokio-webpush-simple
avg: -0.2% min: -0.4% max: -0.1%
inflate
avg: -0.2% min: -0.4% max: -0.1%
inflate-opt
avg: -0.2% min: -0.4% max: -0.0%
regression-31157-opt
avg: -0.1% min: -0.4% max: 0.0%
html5ever-check
avg: -0.3% min: -0.4% max: -0.2%
unused-warnings-check
avg: -0.2% min: -0.3% max: -0.2%
script-servo-check
avg: -0.1% min: -0.3% max: 0.0%
crates.io-check
avg: -0.2% min: -0.3% max: -0.0%
script-servo
avg: -0.1% min: -0.2% max: 0.0%
clap-rs-check
avg: 0.0% min: -0.1% max: 0.2%
deep-vector-check
avg: -0.0% min: -0.2% max: 0.2%
tuple-stress-check
avg: -0.1% min: -0.2% max: 0.0%
crates.io-opt
avg: -0.1% min: -0.2% max: 0.0%
crates.io
avg: -0.1% min: -0.2% max: -0.0%
script-servo-opt
avg: -0.0% min: -0.1% max: 0.0%
```
</details>
|
☀️ Test successful - status-appveyor, status-travis |
eval_context.rs calls
ok_orin multiple places with an eagerlyevaluated
EvalErrorKind::*.into()argument, which callsEvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.
This patch changes the
ok_orcalls intook_or_else, thus avoidingthe evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.
Output from rustc-perf, comparing stage 2 builds with jemalloc disabled: