https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86029
Bug ID: 86029
Summary: gcc -O3 make very slow product
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: hg2ecz at ham dot hu
Target Milestone: ---
I tested a signal processing sample code, and the gcc -O3 give me very slow
binary. It's a compiler error or it is good?
My CPU is i5-3337u, and I use Ubuntu-18.04 64bit OS.
gcc 7.3 and clang 6.0 and I compared with speed of Rust code (rustc 1.24.1)
My sample code and test script:
$ git clone https://github.com/hg2ecz/smallrx
$ cd smallrx/
$ ./gcc-clang-rustc-bench.sh
gcc -Ofast -march=native rx.c -lm -o rx-gcc-Ofast
real 3.81
user 3.80
sys 0.01
clang -Ofast -march=native rx.c -lm -o rx-clang-Ofast
real 6.79
user 6.77
sys 0.02
gcc -O3 -march=native rx.c -lm -o rx-gcc-O3
real 51.76 ----> very slow, clang make faster binary with [-O0, -O1, -O2,
-O3]
user 51.69
sys 0.07
clang -O3 -march=native rx.c -lm -o rx-clang-O3
real 11.05
user 11.03
sys 0.01
./Rust/target/release/smallrx
real 8.26
user 8.22
sys 0.03