当前位置:网站首页>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 getting started complete tutorial: publish and subscribe
- [graph theory] topological sorting
- Redis入门完整教程:键管理
- 智力考验看成语猜古诗句微信小程序源码
- Photoshop批量给不同的图片添加不同的编号
- 【taichi】用最少的修改将太极的pbf2d(基于位置的流体模拟)改为pbf3d
- 高通WLAN框架学习(30)-- 支持双STA的组件
- Object detection based on OpenCV haarcascades
- MySQL数据库备份与恢复--mysqldump命令
- Record: how to scroll screenshots of web pages on Microsoft edge in win10 system?
猜你喜欢
随机推荐
Redis getting started complete tutorial: Key Management
微信小程序显示样式知识点总结
该如何去选择证券公司,手机上开户安不安全
PICT 生成正交测试用例教程
A complete tutorial for getting started with redis: transactions and Lua
Redis getting started complete tutorial: Geo
Servlet+JDBC+MySQL简单web练习
图片懒加载的原理
剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
刷题指南-public
9 - class
MySQL数据库备份与恢复--mysqldump命令
推荐收藏:跨云数据仓库(data warehouse)环境搭建,这货特别干!
Redis入门完整教程:API的理解和使用
UML图记忆技巧
[machine learning] handwritten digit recognition
Is Huatai Securities a nationally recognized securities firm? Is it safe to open an account?
Complete tutorial for getting started with redis: bitmaps
Install the gold warehouse database of NPC
A complete tutorial for getting started with redis: redis usage scenarios









