问题描述
我遇到了以下段落:
here ,播客是。
有人可以指示我到Microsoft文章可以证明这一点吗?
Googling C#debug vs release performance 主要返回结果说调试有很多性能打击,发布被优化和不要将调试部署到生产。
部分是真的。在调试模式下,编译器会为所有变量发出调试符号,并按原样编译代码。在发布模式中,包括一些优化:
- 未使用的变量不会被编译
- 循环变量被编译器从循环中取出,如果它们被证明是不变量
- 在#debug指令下编写的代码不包括在其中。
- unused variables do not get compiled at all
- some loop variables are taken out of the loop by the compiler if they are proven to be invariants
- code written under #debug directive is not included etc.
其余的是由JIT。
编辑:完整的优化列表由
I've encountered the following paragraph:
The source is here and the podcast is here.
Can someone direct me to a Microsoft article that can actually prove this?
Googling "C# debug vs release performance" mostly returns results saying "Debug has a lot of performance hit", "release is optimized", and "don't deploy debug to production".
Partially true. In debug mode the compiler emits debug symbols for all variables and compiles the code as is. In release mode some optimizations are included:
The rest is up to the JIT.
Edit: Full list of optimizations here courtesy of Eric Lippert
这篇关于调试与发布性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!