Do we always have to optimize our algorithms?


#1

Question

Do we always have to optimize our algorithms?

Answer

No, but it is always good practice to try and optimize your algorithms and functions as much as possible and within reason.

In order to optimize an algorithm, it does take some time to think and solve the optimization, which is a tradeoff. However, this can result in a greater return in the long run, as an optimized algorithm will save us time when running programs.

In some cases, an optimization might even be necessary, if the current algorithm is too slow and we need to speed it up. This is increasingly important for large companies that depend on algorithms to keep things fast and dependable.