3 ms·
No, GCC has serious shortcomings in certain areas. -flto=thin is better, autofdo/bolt is better, the jit is better, but the most important point are C constexp
by rurban 7y ago
No, GCC has serious shortcomings in certain areas.
-flto=thin is better, autofdo/bolt is better, the jit is better, but the most important point are C constexpr which are implemented as in C++, but with GCC you cannot decide at compile-time if a constexpr is constant, so it misses out on many optimizations. It only has _Static_assert, but no usable __builtin_constant_p. With GCC it errors at compile-time, with clang it returns 0.
clang also has diagnose_if, e.g. to match user-defined compile-time warnings with user-defined run-time warnings.
e.g. the clang memcpy can be 100x faster than the gcc memcpy, when the size and alignment is known.
And gcc-9 added serious regressions on some platforms, that you need to blacklist it. gcc-10 probably not being better.
- astrange 7y agoWhere do clang and gcc implement memcpy? That's part of the C library.
- BurningCycles 7y agoI have to disagree, -flto=thin is faster in compile time, but in performance I get better results with -flto=n in GCC. Also with FDO I get better results with GCC over Clang/LLVM, my main test subjects are rendering (Blender), archivers, encoders and emulation. However with straight up -O2/-O3 I very often get better performance with Clang/LLVM. I haven't benchmarked on ARM though, my results may be very different there.