当前位置:网站首页>The difference between debug and release
The difference between debug and release
2022-07-04 23:07:00 【Programming segment】
We are using Visual Studio compile cpp Code , There will be debug and release Two modes , So what's the difference between these two modes ?
Say first conclusion :
Generally in the development process , We often write code with bug, For the convenience of debugging , Will choose debug Mode to compile , The purpose is not to let the compiler optimize or optimize less ; But when the version needs to be released after development , In order to make the generated machine code run faster , Often choose release Pattern , In this way, the compiler will help us compile and optimize as much as possible .
Let's explain why
for example , We wrote a piece of code , Calculate from 0 Add to 999 Value , If you don't use compiler optimization , Then the generated assembly code is shown in the right half .
int main()
{
int res;
for(int i=0; i<1000; i++)
{
res += i;
}
return res;
}
however , If used -O3
Level compiler optimization ( The greater the number , The higher the optimization level ), Then the generated assembly code becomes as follows . Because the compiler analysis found that this code is the return 499500 This value , So it will be optimized into such assembly code , Obviously, it runs much faster . But if we need to for In cycle debug During debugging , The compiler will not find such code , Because there is no assembly code for loop , So I won't debug . But the code without optimization can be in for Debug inside the loop .
边栏推荐
- UML图记忆技巧
- Three stage operations in the attack and defense drill of the blue team
- debug和release的区别
- Serial port data frame
- [ODX studio edit PDX] - 0.2-how to compare two pdx/odx files of compare
- A complete tutorial for getting started with redis: hyperloglog
- The solution to the lack of pcntl extension under MAMP, fatal error: call to undefined function pcntl_ signal()
- 位运算符讲解
- A complete tutorial for getting started with redis: understanding and using APIs
- Redis入门完整教程:有序集合详解
猜你喜欢
Redis入门完整教程:哈希说明
Redis入门完整教程:GEO
Redis getting started complete tutorial: Geo
On-off and on-off of quality system construction
Complete tutorial for getting started with redis: bitmaps
Serial port data frame
Unity Xiuxian mobile game | Lua dynamic sliding function (specific implementation of three source codes)
【机器学习】手写数字识别
[roommate learned to use Bi report data processing in the time of King glory in one game]
Redis入门完整教程:慢查询分析
随机推荐
Redis入门完整教程:键管理
[Jianzhi offer] 6-10 questions
ffmpeg快速剪辑
Redis入门完整教程:Pipeline
Basic use and upgrade of Android native database
Redis:Redis的事务
S32 Design Studio for ARM 2.2 快速入门
时间 (计算)总工具类 例子: 今年开始时间和今年结束时间等
Redis入门完整教程:客户端通信协议
Redis getting started complete tutorial: publish and subscribe
qt绘制网络拓补图(连接数据库,递归函数,无限绘制,可拖动节点)
LabVIEW中比较两个VI
9 - class
Redis introduction complete tutorial: List explanation
Redis入门完整教程:发布订阅
On-off and on-off of quality system construction
Attack and defense world misc advanced area can_ has_ stdio?
Gnawing down the big bone - sorting (II)
How to choose a securities company? Is it safe to open an account on your mobile phone
Is Huatai Securities a nationally recognized securities firm? Is it safe to open an account?