Skip to content

Turn off runtime assertions, turn on runtime optimizations #2589

@brson

Description

@brson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsI-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions