Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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%.
- Loading branch information