Let's start here: are you sure you need to do it at all? Is your code really so bad? Is it worth the time to tune it? Over
the lifetime of your application, how much time is going to be spent running that code, compared to the time spent
waiting for a remote database server, or waiting for user input?
Second, are you sure you're done coding? Premature optimization is like spreading frosting on a half−baked cake.
You spend hours or days (or more) optimizing your code for performance, only to discover it doesn't do what you
need it to do. That's time down the drain.
This is not to say that code optimization is worthless, but you need to look at the whole system and decide whether it's
the best use of your time. Every minute you spend optimizing code is a minute you're not spending adding new
features, or writing documentation, or playing with your kids, or writing unit tests.
Oh yes, unit tests. It should go without saying that you need a complete set of unit tests before you begin performance
tuning. The last thing you need is to introduce new bugs while fiddling with your algorithms.
the lifetime of your application, how much time is going to be spent running that code, compared to the time spent
waiting for a remote database server, or waiting for user input?
Second, are you sure you're done coding? Premature optimization is like spreading frosting on a half−baked cake.
You spend hours or days (or more) optimizing your code for performance, only to discover it doesn't do what you
need it to do. That's time down the drain.
This is not to say that code optimization is worthless, but you need to look at the whole system and decide whether it's
the best use of your time. Every minute you spend optimizing code is a minute you're not spending adding new
features, or writing documentation, or playing with your kids, or writing unit tests.
Oh yes, unit tests. It should go without saying that you need a complete set of unit tests before you begin performance
tuning. The last thing you need is to introduce new bugs while fiddling with your algorithms.
Comments
Post a Comment
https://gengwg.blogspot.com/