Commit 03d03c6
committed
Always inline check in
The current complexities in `assert_unsafe_precondition` are delicately
balancing several concerns, among them compile times for the cases where
there are no debug assertions. This comes at a large runtime cost when
the assertions are enabled, making the debug assertion compiler a lot
slower, which is very annoying.
To avoid this, we always inline the check when building with debug
assertions.
Numbers (compiling stage1 library after touching core):
- master: 80s
- just adding `#[inline(always)]` to the `cfg(bootstrap)`
`debug_assertions`: 67s
- this: 54s
So this seems like a good solution. I think we can still get
the same run-time perf improvements for other users too by
massaging this code further (see my other PR about adding
`#[rustc_no_mir_inline]`) but this is a simpler step that
solves the imminent problem of "holy shit my rustc is sooo slow".
Funny consequence: This now means compiling the standard library with
dbeug assertions makes it faster (than without, when using debug
assertions downstream)!assert_unsafe_precondition with cfg(debug_assertions)1 parent 8a49772 commit 03d03c6
1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2575 | 2575 | | |
2576 | 2576 | | |
2577 | 2577 | | |
| 2578 | + | |
2578 | 2579 | | |
2579 | 2580 | | |
2580 | 2581 | | |
| |||
2659 | 2660 | | |
2660 | 2661 | | |
2661 | 2662 | | |
2662 | | - | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
2663 | 2670 | | |
2664 | 2671 | | |
2665 | 2672 | | |
| |||
0 commit comments