What do the optimization levels `-Os` and `-Oz` do in rustc?

前端 未结 2 416
温柔的废话
温柔的废话 2021-01-07 17:04

Executing rustc -C help shows (among other things):

-C opt-level=val       -- optimize with possible levels 0-3, s, or z

相关标签:
2条回答
  • 2021-01-07 17:31

    Looking at these and these lines in Rust's source code, I can say that s means optimize for size, and z means optimize for size some more.

    All optimizations seem to be performed by the LLVM code-generation engine.

    0 讨论(0)
  • 2021-01-07 17:46

    It seems like you are not the only one confused, as described in a Rust issue. It seems to follow the same pattern as Clang:

    • Os For optimising the size when compiling.
    • Oz For even more size optimisation.
    0 讨论(0)
提交回复
热议问题