I have a Microsoft Surface Pro (5th Generation) with the i5 processor and use the GNU GCC Compiler. Now I want to use optimization settings for this compiler and I don't know what settings are "working" with my processor.
Overview of my system:
Does anyone has an a similar system? Thanks in advance.
Kind Regards
randomcoder
You can always use the flag -march=native
, which tells the compiler to detect the CPU of the computer that's being used to compile, and optimize the code for that type of CPU. This is ideal when you are compiling on the same machine you will be running the code on. Note that the resulting executable will not necessarily work on other computers with different CPUs.
Of course, you also have to use one of the -O
options, typically -O2
, to get optimizations at all. There are many other specific optimization options, but whether they are helpful will depend on what your program actually does.