If you're, for example, rewriting an obviously correct but slow piece of code X into a faster but not obvious code Y, how do you know if the two are functionally identical without at least some knowledge of program algebra?
by testing and measuring performance ?
In real world it is rare that you have easy way to guess actual overall impact of your optimization.
sure you profile and go for hotspots but still it is very hard to actually understand full impact and CS algorithms are done in ideal conditions so they don't address complexity of executing environment and might be misleading path for optimization.
sure you profile and go for hotspots but still it is very hard to actually understand full impact and CS algorithms are done in ideal conditions so they don't address complexity of executing environment and might be misleading path for optimization.