about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-02-16 19:43:50 +0100
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-02-19 17:28:49 +0100
commit03d03c666c337acdaeb8911deaade55366bf8959 (patch)
tree8fedd68f446047ed4f6b4e02d0c497600af31a0b /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent8a497723e311a62fccb1f0bf40e79c6519744a12 (diff)
downloadrust-03d03c666c337acdaeb8911deaade55366bf8959.tar.gz
rust-03d03c666c337acdaeb8911deaade55366bf8959.zip
Always inline check in `assert_unsafe_precondition` with cfg(debug_assertions)
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)!
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions