当前位置:网站首页>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 .
边栏推荐
- Notepad++--编辑的技巧
- The small program vant tab component solves the problem of too much text and incomplete display
- Redis入門完整教程:Pipeline
- 常用技术指标之一文读懂BOLL布林线指标
- 刷题指南-public
- Unity vscode emmylua configuration error resolution
- Feature scaling normalization
- Gnawing down the big bone - sorting (II)
- 字体设计符号组合多功能微信小程序源码
- 剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
猜你喜欢
Redis introduction complete tutorial: client communication protocol
JS card style countdown days
Redis: redis configuration file related configuration and redis persistence
字体设计符号组合多功能微信小程序源码
A complete tutorial for getting started with redis: getting to know redis for the first time
[sword finger offer] questions 1-5
Redis introduction complete tutorial: List explanation
Redis入门完整教程:HyperLogLog
Google Earth engine (GEE) - tasks upgrade enables run all to download all images in task types with one click
qt绘制网络拓补图(连接数据库,递归函数,无限绘制,可拖动节点)
随机推荐
A complete tutorial for getting started with redis: hyperloglog
Set up a website with a sense of ceremony, and post it to 1/2 of the public network through the intranet
该如何去选择证券公司,手机上开户安不安全
Redis入门完整教程:客户端通信协议
Complete tutorial for getting started with redis: bitmaps
Sword finger offer 68 - I. nearest common ancestor of binary search tree
How to choose a securities company? Is it safe to open an account on your mobile phone
Sobel filter
A complete tutorial for getting started with redis: transactions and Lua
Redis入门完整教程:慢查询分析
Redis入门完整教程:Bitmaps
Sword finger offer 68 - ii The nearest common ancestor of binary tree
【爬虫】数据提取之JSONpath
Summary of wechat applet display style knowledge points
Redis introduction complete tutorial: detailed explanation of ordered collection
Redis入门完整教程:事务与Lua
vim编辑器知识总结
P2181 diagonal and p1030 [noip2001 popularization group] arrange in order
Redis入門完整教程:Pipeline
字体设计符号组合多功能微信小程序源码