In my testing, -O1 results in slower compile times than -O0.
Emitting debug symbols doesn't change compile times.
Emitting debug symbols doesn't change compile times.
Or maybe my projects are the interesting ones :D
My project is c, which is why I can use tcc.
Anyway, that makes sense; in c++, there's a lot of 'extra' stuff, single lines of code that add up to much more than they would seem. I bet -O1 lets the compiler inline a lot of std::move, smart ptr semantics; elide monomorphisations, copy constructors/RVO; etc. Which just means less code to spit out the backend.
Yes for C what you mention makes perfect sense.
I agree with you about C++ as well. In particular, C++ templates end up expanding a lot of duplicate code, and at O1 the compiler can remove them.