当前位置:网站首页>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 .
边栏推荐
- Google Earth engine (GEE) - tasks upgrade enables run all to download all images in task types with one click
- LIst 相关待整理的知识点
- mamp下缺少pcntl扩展的解决办法,Fatal error: Call to undefined function pcntl_signal()
- 剑指Offer 68 - II. 二叉树的最近公共祖先
- Sword finger offer 68 - ii The nearest common ancestor of binary tree
- Unity vscode emmylua configuration error resolution
- Analog rocker controlled steering gear
- 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
- Complete tutorial for getting started with redis: bitmaps
- Set up a website with a sense of ceremony, and post it to 1/2 of the public network through the intranet
猜你喜欢
Redis入门完整教程:哈希说明
【图论】拓扑排序
Redis入门完整教程:HyperLogLog
Complete tutorial for getting started with redis: bitmaps
P2181 diagonal and p1030 [noip2001 popularization group] arrange in order
Sobel filter
Three stage operations in the attack and defense drill of the blue team
ETCD数据库源码分析——处理Entry记录简要流程
Explanation of bitwise operators
【室友用一局王者荣耀的时间学会了用BI报表数据处理】
随机推荐
[ODX studio edit PDX] - 0.2-how to compare two pdx/odx files of compare
机器学习在房屋价格预测上的应用
cout/cerr/clog的区别
Advantages of Alibaba cloud international CDN
PICT 生成正交测试用例教程
【二叉树】节点与其祖先之间的最大差值
剑指 Offer 67. 把字符串转换成整数
[Jianzhi offer] 6-10 questions
图片懒加载的原理
Async await used in map
Redis入门完整教程:GEO
Complete tutorial for getting started with redis: bitmaps
【爬虫】数据提取之JSONpath
A complete tutorial for getting started with redis: hyperloglog
A complete tutorial for getting started with redis: getting to know redis for the first time
Basic knowledge of database
MP进阶操作: 时间操作, sql,querywapper,lambdaQueryWapper(条件构造器)快速筛选 枚举类
Unity Xiuxian mobile game | Lua dynamic sliding function (specific implementation of three source codes)
Docker镜像的缓存特性和Dockerfile
Wechat official account solves the cache problem of entering from the customized menu