Optimisation: Is it worth the time? (part 1)
Let’s say you have a routine task (it doesn’t have to be a programming task, but that’s what your mind is almost always on, right?). We can call it Task A.
If optimising Task A takes a full day to complete, and it can purportedly shave one minute off the normal amount of time you need to do it, how often must you do this task for it to be worth the time optimising?
Here’s the same question, just asked in a different way:
If Task A is something you do every single day, and optimising it saves you one minute compared to pre-optimisation, how much time can you put into optimisation for the effort to be worth the time?
And, finally (you probably see where I’m going with this) here’s one final way to ask the question:
If you need to do Task A every single day, and it takes you one full day to finishing optimising the task, how much time must you be able to shave off with the optimisation for it to be worth the time?
Sorry for turning your brain mushy from that exercise — I also turned my head upside down rewriting those sentences a few times to get them right.
But what these are are 3 ways to ask the same question about whether spending time on doing something that optimises efficiency is going to be worth the time.
The answer to these 3 questions? Well, if you look closely, they can be inferred. But here they are:
- How often must you do Task A for it to be worth the time if optimising it can shave off one minute? Daily.
- How much time can you put into optimisation for the effort to be worth the time if it can shave off one minute? One day, max.
- How much time must you be able to shave off a daily task for it to be worth the time spending one full day optimising? One minute, at least.
If a task is DAILY and optimising saves 1 MINUTE, you can spend at most 1 DAY on the optimisation… for it to be worth the time.
If you spend 1 DAY optimising to a task to save 1 MINUTE, you must at least do this task DAILY… for it to be worth the time.
If you spend 1 DAY optimising a DAILY task, you must at least save an extra 1 MINUTE each time you do the task… for it to be worth the time.
Ok, I’ve run out of ways to distil this. Thankfully there’s xkcd.
For me, the one that best conveys the scales involved is “If a task is DAILY and optimising saves 1 MINUTE, you can spend at most 1 DAY on the optimisation.”
But wait! There’s a fine print in this comic: “(ACROSS FIVE YEARS)”.
That means the calculations are done based on a timeline of doing the task for at least 5 years. Then we have to ask ourselves, what proportion of all the tasks that we do are tasks that we will be doing for at least 5 years?
My personal answer is… quite many, actually.
Stay peeled to the next post where I’ll break down some of the most common tasks we do at work as programmers and classify them as worth the time or not! In the meantime, here are some of my other posts about optimisation.
Bite Size Programming is a segment where I discuss programming one bite-sized topic at a time in plain English. My goal is to share tips, lessons, and ideas from my work as a software engineer, and through that, make programming accessible and fun for anyone who is curious about programming. Join the mailing list to get the latest post delivered to your inbox so you can read on the go.
Originally published at Nick Ang.