3 ms·
So you are saying that we should throw away every single optimization, and go back to C being a fancy assembler? As if we consider the memory layout at all time
by kaba0 5y ago
So you are saying that we should throw away every single optimization, and go back to C being a fancy assembler? As if we consider the memory layout at all times inspectable, pretty much any optimization is impossible. Also, the compiler produces code for the CPU not a debugger — here you can’t implicitly view memory at arbitrary places.
I personally prefer to write code that is more readable to humans that will get translated to the optimal instructions over having to learn some tricks known only by some elite C hacker that will actually be inferior, since CPUs are finicky. Even with very good understanding of the CPU one can not really guess which instructions are faster to execute without benchmarks.
Nonetheless, there are tiny C compilers that do next to no optimizations, feel free to compare the speed of the resulting binaries.