3 ms·
> >"-Ofast" same as "-O3 -ffast-math" That depends on the language and the GCC version. > -ffast-math makes the compiler violate IEEE, it would make a very ba
by gnufx 6y ago
> >"-Ofast" same as "-O3 -ffast-math"
That depends on the language and the GCC version.
> -ffast-math makes the compiler violate IEEE, it would make a very bad default.
Yes, but unfortunately it's the Intel default, which contributes to some of the compiler mythology.
Regarding unrolling, you usually do want it in numeric loops, and -O3 unrolls (and jams) as -fopt-info shows.
- simias 6y ago>That depends on the language and the GCC version. I was quoting TFA verbatim. I actually never use -Ofast myself, beyond -O3 I tend to use the individual flags manually, checking wit benchmarks that it makes a difference. >Yes, but unfortunately it's the Intel default, which contributes to some of the compiler mythology. I didn't know that. I guess Intel is extremely performance-oriented and doesn't really care for portability so it makes some sense for them to do that. >Regarding unrolling, you usually do want it in numeric loops, and -O3 unrolls (and jams) as -fopt-info shows. Sure but that's to my point: the default optims for -O3 are fairly aggressive already. Unless you're writing code where performance is absolutely critical you'll probably be do just fine just remembering to pass "-Wall -O3" to GCC and that's it. Actually for most of my code where I want good performance but I'm not counting individual clock cycles I tend to default to -O2 which gives you most of the performance benefits with more conservative and easier to debug optimizations. And for cases where you need to go beyond -O3 you'll probably have to write some benchmarking code before you can decide which additional option to use. At least, in my experience.