-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Description
The runtime has several performance-sensitive code paths that are compromising between going fast and making important assertions.
Right now the runtime knows about RUST_DEBUG and RUST_NDEBUG macros. When RUST_DEBUG is defined we do assertions about lock ownership and not much else. RUST_NDEBUG is defined by default, not RUST_DEBUG.
Let's make greater use of this by disabling expensive assertions and enabling optimizations. Because this involves disabling a lot of very checks we'll have RUST_DEBUG on by default.
Without RUST_DEBUG we can
- Run the box annihilator on normal task exit without worrying about obscuring cycle collector errors
- Turn off valgrind hints on stack allocation and switching paths that have real overhead
- Turn off check_stack_canary
- Turn off other expensive asserts
By default (with RUST_DEBUG) you get
- More locking assertions
- More calls to check_stack_canary
- More expensive asserts on the stack switching fast paths
Most likely this will involve changing the configure script too. Instead of --enable-debug we would have --disable-debug. Since this should end up with a noticeable performance difference between the two, configure
and/or make all
and make check
might want to mention it, perhaps even in a handsome ascii-art box.
Notes
- Make sure to measure each to make sure it's worth doing
- Some of these performance issues are also addressed by Inline get_sp_limit, set_sp_limit, get_sp runtime functions #2521
- The box annihilator needs additional performance work