Kayavak / Workbench / Compiler lab
Workbench
Compiler lab
Every language and compiler on Compiler Explorer, from C, C++, Rust, Zig and Go to Fortran, Haskell and dozens more. Pick a compiler and its version, set the flags, and see what your program becomes: the assembly for each source line, what each instruction does, what analysis tools say about it, and what it prints when it runs. Change one flag and compile again to see why it matters.
Things to try
- Compile the C++ starter at
-O0, then-O2: the loop becomes a formula. - Compile the same function with GCC and with Clang, and compare the instructions each chooses.
- In Rust, index a slice inside a loop, then iterate it instead, and look for the bounds checks.
- In Zig, switch between
-O Debugand-O ReleaseFastand find the safety checks. - Pick a tool such as llvm-mca to see how many cycles a loop needs on a given CPU.