当前位置:网站首页>O0 O1 O2 O3 optimization principle
O0 O1 O2 O3 optimization principle
2022-04-22 22:47:00 【Mind hacker】
In order to speed up the efficiency of code execution , quite a lot OJ The platform will start automatically O2 Optimize .
Here we talk about how to optimize .
O0 Optimize
#pragma GCC optimize(0)
1、 Assign variables to registers .
2、 Analyze the various situations that will occur in the cycle , Keep only one branch that exits the loop .
3、 Delete useless code .
4、 Simplify expressions and declarations .
5、 Will use inline The declared inline function becomes a function call .
O1 Optimize
#pragma GCC optimize(1)
contain O0 Various optimization functions of , And increased. :
1、 In variable assignment , Assign the value directly to the variable instead of giving the address of the variable .
2、 Remove useless variables and expressions .
3、 Remove the general expression .
O2 Optimize
#pragma GCC optimize(2)
contain O1 Various optimization functions of , And increased. :
1、 Remove the global sub expression .
2、 Remove the allocation variables and expressions that are not used globally .
3、 Resolve cycle .
When only -O Option, the optimizer automatically -O2 Optimize .
O3 Optimize
#pragma GCC optimize(3)
contain O2 Various optimization functions of , And increased. :
1、 Remove the function not called .
2、 Simplify functions that return unused values .
3、 Make embedded calls to small functions .
4、 Reorder the called function declarations , So that the optimized caller can find the function .
5、 Complete file level optimization .
版权声明
本文为[Mind hacker]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222200580409.html
边栏推荐
猜你喜欢

对象大小与指针压缩--JVM

加法逆元(a^a=0)异或操作,这个并没有性能上的优势,只是一个智力游戏

scanpy find resolution

【Paper】2019_Distributed fixed-time consensus-based formation tracking for multiple nonholonomic whee

Advanced multithreading (8) -- thread pool

R语言数据分析从入门到高级:(九)数据清洗技巧之数据表连接大全

CAS统一身份认证(二):Overlay配置管理

Llvm learning (III) - example learning

51单片机proteus仿真 按键控制数码管数字显示

396. 旋转函数 / 剑指 Offer II 013. 二维子矩阵的和
随机推荐
外部中断---------stm32f407zet6
[easy to understand and intensive learning] 1 Introduction
Official account is configured for pseudo static to prevent page path loading.
appinventor2在window上搭建步骤
js力扣每日一题(2022/4/22)---396.旋转函数
MySql内置函数
MySql--- 数据类型
MTP管理课养成计划-第2天学习笔记
二分法应用:875. 爱吃香蕉的珂珂
0-1背包问题讲解 & leetcode相关题目总结
Fastadmin limit search criteria after jump
[summary of scattered knowledge points 5]
[wechat applet development (cloud wallpaper applet tutorial)]
MySql--表的操作
TOOLS. INI‘does not contain a valid tool path
静态和动态控制数码管
NLP direction -- interview and written test question set (7): pre training model Bert
快速计算约数的个数——从基础到高级
GBase 8s V8. 8 SQL Guide: Tutorial - 6.2.1 (4)
GBase 8s V8.8 SQL 指南:教程-6.2.2(1)