当前位置:网站首页>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 .

边栏推荐
猜你喜欢

Redis入门完整教程:键管理

A complete tutorial for getting started with redis: Pipeline
![[roommate learned to use Bi report data processing in the time of King glory in one game]](/img/06/22dde3fcc0456bd230e1d0cde339ec.png)
[roommate learned to use Bi report data processing in the time of King glory in one game]

Redis入门完整教程:列表讲解

vim编辑器知识总结
![[sword finger offer] questions 1-5](/img/54/b70d5290978e842939db99645c6ada.png)
[sword finger offer] questions 1-5

Duplicate ADMAS part name
![[OpenGL] note 29 anti aliasing (MSAA)](/img/66/61f29e1c41d3099d55e2ead0a3b01e.png)
[OpenGL] note 29 anti aliasing (MSAA)

Unity vscode emmylua configuration error resolution

Redis入门完整教程:慢查询分析
随机推荐
Redis入门完整教程:哈希说明
How to choose a securities company? Is it safe to open an account on your mobile phone
Duplicate ADMAS part name
Redis:Redis消息的发布与订阅(了解)
字体设计符号组合多功能微信小程序源码
SPH中的粒子初始排列问题(两张图解决)
P2181 diagonal and p1030 [noip2001 popularization group] arrange in order
Redis getting started complete tutorial: publish and subscribe
One of the commonly used technical indicators, reading boll Bollinger line indicators
Tweenmax emoticon button JS special effect
Qt个人学习总结
Redis入门完整教程:Redis使用场景
数据库基础知识
The small program vant tab component solves the problem of too much text and incomplete display
qt绘制网络拓补图(连接数据库,递归函数,无限绘制,可拖动节点)
Sobel filter
MariaDB的Galera集群应用场景--数据库多主多活
Google Earth engine (GEE) -- take modis/006/mcd19a2 as an example to batch download the daily mean, maximum, minimum, standard deviation, statistical analysis of variance and CSV download of daily AOD
Serial port data frame
colResizable. JS auto adjust table width plug-in