Skip to content

Commit ef9fff7

Browse files
committed
Update: Compiler Optimization
1 parent a048523 commit ef9fff7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

compiler/optimization.rst

+22-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Optimizations
33
========================================
44

5-
========================================
5+
6+
.. contents:: 目錄
67

78

89
PGO (Profile-Guided Optimizations)
@@ -14,7 +15,27 @@ PGO (Profile-Guided Optimizations)
1415
- ``-fprofile-generate``
1516
- ``-fprofile-use``
1617

18+
19+
1720
IPO (Interprocedural Optimization)
1821
========================================
1922

2023
* `Wikipedia - Interprocedural optimization <https://en.wikipedia.org/wiki/Interprocedural_optimization>`_
24+
25+
26+
27+
Misc
28+
========================================
29+
30+
* ``-O3`` 就正常 general 的優化盡量開
31+
* ``-Ofast`` 除了 ``-O3`` 的參數外,還會加一些更 aggressive 的參數(通常跟數學運算有關
32+
* ``-march=native`` 是以目前在編譯的 CPU 為目標對象做優化,可能會利用到一些特定 CPU 才有的指令(例如 SSE、AVX)
33+
* ``-flto`` 是開 link time 的優化
34+
35+
36+
37+
參考
38+
========================================
39+
40+
* `Gentoo Wiki - GCC Optimization <https://wiki.gentoo.org/wiki/GCC_optimization>`_
41+
* `Stack Overflow - Clang optimization levels <http://stackoverflow.com/questions/15548023/clang-optimization-levels>`_

0 commit comments

Comments
 (0)