If I compile plain C code using icc 17.0.1, it creates executable (if stripped) of 105k size, while the gcc (6.3.0 and 4.8.5) creates 8k size executable. The executable compiled with icc is also about 20% slower. Also, for some reason icc unnecessarily links to libdl.so and libgcc_s.so libraries.
I was under impression icc was meant to produce better performing executables than gcc ..
Is there anything I can do here with icc to get a better-performing, smaller executable, than with gcc ?
I tried different command-line switches, with the same result, as an example:
icc -s -Os -march=native -fno-exceptions -DNDEBUG -mtune=native -Wl,--gc-sections -Wl,--as-needed -o myprog myprog.c
produces (after stripping) 105k executable which takes about 8.6 seconds to execute
gcc -s -Os -march=native -fno-exceptions -DNDEBUG -mtune=native -Wl,--gc-sections -Wl,--as-needed -o myprog myprog.c
produces 8k executable which takes 7.7 seconds to execute
This is all on i7-3770 3.4GHz CPU 8Gb RAM GNU/Linux
For icc try replacing -march=native with -xHost
native is not listed in the icc documentation under march (this may or may not be a documentation error).
Hi, in response to comment #4: it does not look like icc linked anything to icc runtime. Instead it unnecessarily linked to libdl.so and libgcc_s.so which are part of glibc and gcc.
I'm curious, if I can download icc version 11 somewhere and try that one?