It is not worth optimizing your code further ⚡
We all love optimizing the code we write and making sure it is not wasting any CPU cycles, having memory leaks, or doing unnecessary work. But optimization is governed by the Law of Diminishing Returns.
The initial gains of optimization tend to be substantial and with 20% effort, we would be achieving 80% of benefits. But as we get closer to theoretical performance limits, the effort required to squeeze out each additional millisecond increases exponentially.
Hence, it is crucial to identify the point where further optimization offers negligible benefits compared to the invested time and resources. Hence we always list down the optimization action items, stack rank them as per potential impact, and pick the most impactful and the easiest items first.
⚡ I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.
youtube.com/c/ArpitBhayani