2 ms·
They compile the “C++” (which isn’t C++ but some implementation of C++, likely Apple clang 15.0.0) without any optimizations. g++ -std=c++14 1bn.cpp time .
by Someone 3y ago
They compile the “C++” (which isn’t C++ but some implementation of C++, likely Apple clang 15.0.0) without any optimizations.
g++ -std=c++14 1bn.cpp
time ./a.out
1000000000
When I run this on a Macbook Air M2 without optimizations versus with “-O3”, wall clock running time decreases from about 700ms to 6 ms (sometimes less than that)
(Also, with “-O3”, changing the loop limit doesn’t affect running time, so clang optimizes away that loop)