Sometimes developers are over excited about creating an optimized solution by optimizing & refactoring the code. They try to optimize every bit and line to their heart's content. Optimization is an art, but sometimes you gotta admit that overdoing any art, loses it's beauty. So, what optimization process should be followed? Well, I want to share my view on that matter.
Thank you for reading.
Create a solution but don't bother about the "Perfect solution"What good a highly optimized, well written & well maintained code base can do, when it can not solve the problem? The simple answer is nothing. Every solution is written so that it could solve a problem. If you are given a non working but nicely written application will you choose it over a badly coded working solution? I guess, you got the point.
Optimize the solution but never over do itThen next state would be optimize the solution. After you have a solution you can make it more better. Break the function into small functions. Group the class into a module. Apply DP where appropriate.
The 90 - 10 ruleTry to optimize the section which consumes most of the time. The 90 - 10 rule follows as - 10% of code constitutes 90% of total running time of the application. Have you ever think of any solution not having a loop? Have you seen a complex algorithm not having several loops? These loops are the CPU cycle hogger. They are the 10% out of 100% code. Try to optimize that 10% before optimizing other sections. Slight improvement over that 10% will leave a mark on the performance of your application.
Thank you for reading.