Understanding the Compiler

With the web-based compile explorer (www.godbolt.org) you can easily inspect what your compiler does to your high level code – not meaning that that’s easily understood. 14 different languages are supported (Haskell, C++, Rust, D, …) for the input and many different compilers and versions can be chosen for the output. You can inspect the resulting assembler code with some simplification features, and color coding. Multiple views and windows can be arranged side by side.

Here, the different output of a short loop in C++ in optimized compile (-O3) in clang 6 vs gcc 8. When disabling the optimization the SIMD instructions will disappear:

When changing the high level code it re-compiles on the fly. It’s pretty astonishing how the same functionality looks different in the final assembler codes.