we all know that code optimization in most of the languages is done after the intermediate code. i wanted to ask what are the drawbacks or we can say why it is not beneficial to perform code optimization in the early stages of a program/software development.
Optimized code is typically harder to read and change then un-optimized code. If the code is harder to read then it's harder to track down bugs. If it's harder to rewrite then it's harder to alter/add/remove features. Finally the vast majority of code 'optimizations' that people do don't really make any difference. Typically your loosing a large amount of maintainability for a pitiful amount of performance.
Also, the majority of compiler optimizations are difficult to write so that they operate at the level of the abstract syntax tree. Focus on getting your programs to work correctly.