| ▲ | CoastalCoder 2 hours ago | ||||||||||||||||
> Never ever build in '-03 -march=native' by default. This is always a red flag and a sign of immaturity. Perhaps you can see how there are some assumptions baked into that statement. | |||||||||||||||||
| ▲ | eqvinox 2 hours ago | parent | next [-] | ||||||||||||||||
What assumptions would that be? Shipping anything built with -march=native is a horrible idea. Even on homogeneous targets like one of the clouds, you never know if they'll e.g. switch CPU vendors. The correct thing to do is use microarch levels (e.g. x86-64-v2) or build fully generic if the target architecture doesn't have MA levels. | |||||||||||||||||
| |||||||||||||||||
| ▲ | PufPufPuf an hour ago | parent | prev | next [-] | ||||||||||||||||
The only time I used -march=native was for a university assignment which was built and evaluated on the same server, and it allowed juicing an extra bit of performance. Using it basically means locking the program to the current CPU only. However I'm not sure about -O3. I know it can make the binary larger, not sure about other downsides. | |||||||||||||||||
| |||||||||||||||||
| ▲ | izacus an hour ago | parent | prev [-] | ||||||||||||||||
Not assumptions, experience. I fully concur with that whole post as someone who also maintained a C++ codebase used in production. | |||||||||||||||||