In today's episode (and the next episode of Developer Tea), we discuss avoiding over-optimization by creating a "performance budget".
Transcript (Generated by OpenAI Whisper)
Hey everyone and welcome to Developer Tea my name is Jonathan Cutrell and in today's episode we continue our discussion on over optimization and creating a performance budget. If you missed the last episode of Developer Tea I recommend you go and listen to it before you listen to today's episode partially because we pick up in the middle of a list of five things that you need to consider when you're creating a performance budget but also because we talk a little bit about over optimization and and why you don't want to over optimize and how that can occur. Today's episode is sponsored by FreshBooks. FreshBooks is the ridiculously easy to use online accounting software designed to help creative entrepreneurs get organized, save time and get paid faster. We will talk about how all of that works later on in the show. So we left off in the middle of the list of five things that you need to be thinking about when you create your performance budget and before we dive into the last two I want to make sure that I remind you of the first three. Number one was determine the usage rate over time of the piece of code that you're considering optimizing. Determine the usage rate over time and number two determine the lifetime of that particular piece of code and when you combine these two things you can determine the amount of value that you could potentially add by performing that optimization. Finally number three what are the minimum optimizations necessary? What are the minimum requirements? The minimum optimizations necessary. It may be readability of text. It may be running time. It could be anything but you have to determine that minimum optimization necessary. This will end up reading directly into your performance budget and you should treat these like in a financial budget you would treat bills. You can't invest in something without paying your bills first and an optimization is an investment. You want a long term return on that investment. This is why we use that metaphor of a budget. If you think about your minimum optimizations as absolutely necessary before you go and do any other optimizations then the priority of a particular optimization becomes a little bit clearer. That is why we need to determine those minimum optimizations. Number four for today what are the useful performance limits? What are the useful performance limits? What we mean by useful limits or useful performance limits here is the minimum metrics or optimizations that actually matter to the end user. For example, optimizing more than about 100 frames per second in any given app that a user is looking at, optimizing that interface to be faster than 100 frames per second is arguably not really necessary. As we don't really notice the difference as humans or eyes can't really notice the difference beyond 100 frames per second. Again, that's a little bit debated but there is a number of frames per second that if you go past that it's not really adding any extra benefit for us. So that would be that useful performance limit. However, for your particular project you may also determine that optimizing for a frame rate any greater than 30 frames per second isn't necessary. For example, if you have a static UI that doesn't really move around that's not really scrollable you may not need much more than 30 frames per second. And so it totally depends on your project what those useful performance limits are. Think about the way you will determine these useful minimums. Take some time and think about it. Don't take the blanket advice of any particular number that you find on a Google search. Think about the users for your particular application. A human doesn't notice the difference of five milliseconds of optimization of an action they take 10 or 20 times or even 100 times. But a computer running an algorithm a million times a day will certainly notice the difference of five milliseconds. In fact, five milliseconds difference on a million operations times that five milliseconds is just over 83 minutes of time. So in one scenario, five milliseconds may be negligible. But in the other scenario optimizing for five milliseconds may mean significant computing resources. The useful performance limits of high use algorithms then are going to be significantly more vigorous than the limits on a human performed action. So that's one thing that you may take into account when you determine your useful performance limits. So again, number four, what are the useful performance limits of that particular piece of code? And finally, number five, investment for optimization required. Determine the investment for that particular optimization. How much time and energy will it take to accomplish a particular optimization to its minimum optimization level? Remember step three, we determined the minimum minimum optimization. This is why we need to determine how much time and energy it takes to reach to that minimum optimization. Be certain to consider if you can accomplish 50% of that optimization in one day and the next 50% takes two weeks. This shows you that the optimization as the optimization level increases the amount of investment needed to optimize further increases exponentially. And this is similar to the 80 20 rule. If you have heard of the 80 20 rule, the idea that 80% of the benefit comes from 20% of the work. So you want to determine that investment necessary for that minimum optimization, but also the investment necessary for that useful performance limit, that maximum useful optimization. We're going to take a quick sponsor break and then we're going to talk about how you can use these five things to actually create your performance budget. Today's episode is sponsored by FreshBooks. Using FreshBooks to create and send an invoice literally takes about 30 seconds. There's no formulas or formatting just perfectly crafted and invoices every single time. And your clients can pay you online, which means you end up getting paid a lot faster. If a client forgets to pay you on time, FreshBooks handles that awkward conversation of reminding them about their late payments. FreshBooks also makes expense tracking very easy. They have a mobile app that lets you take pictures of your receipts and FreshBooks automatically organizes them for later. They also have automation. You can automatically import expenses directly from your bank account. So next time you use your debit card for that business lunch, watch the transaction magically appear in your FreshBooks account. You can also track time with FreshBooks. They have cash flow tracking. You can know what you did and when you did it and the little details about your cash flow are kept in one place. So FreshBooks knows exactly what invoices you sent, when you sent them and who's paid you and perhaps most importantly, who owes you what. FreshBooks is offering a free month to Developer Tealisteners. To claim that free month, go to FreshBooks.com slash Developer Tea and enter Developer Tea and the how did you hear about a section when you sign up. Thanks again to FreshBooks. That link will be in the show notes at spec.fm. So today's episode is part two of talking about over optimization and fixing that with a performance budget and we're talking about five things you need to think about when you're creating that performance budget. Number one, the usage rate over time of that particular piece of code. Number two, the lifetime of that piece of code. Number three, the minimum optimizations that are necessary. Number four, the useful performance limits of that particular piece of code. And finally, the investment for optimization for the minimum and the limit, the minimum necessary and that performance limit that we've talked about. Once you have these five elements, once you have these five elements, the usage rate over time, the lifetime of the code, the minimum optimizations, the useful performance limits. And finally, the investment required for that optimization in both the minimum and the maximum cases, you can create a budget in each of these categories that maximizes the value and minimizes the investment of your time. Okay, this is a basic ROI calculation. Start by determining the minimum and maximum optimization parameters for each optimization. We can build our base budget by looking at the investment necessary to meet all of our minimum optimizations. These are like your bills. It's quite possible that this will max out all of your available resources. Let me say this again. It's quite possible that meeting the minimum optimizations will max out all of your available resources for optimization time. The time that you spend on optimization, you may not be able to go any further than the minimum. You need to determine that before you start down the road of over optimizing a particular feature. No further optimization will be possible without increasing your resources. So don't fall into the trap of over optimizing on one point and not meeting the minimum optimization on another feature. Okay, be sure that you do this calculation that you determine what that minimum is. Next, determine a return on investment of any optimization by looking at the usage rate over time multiplied by the lifetime of the code. We then want to combine this with the resources necessary to accomplish the optimization. In other words, if I can find an optimization that gives me a moderate amount of return with very little investment and I compare that to an optimization that gives a high amount of return but requires a high investment, I might make this strategic decision to prioritize the moderate return and little investment over the high return high investment. Again, I'm not going to talk about product planning necessarily in today's episode, but this gives you an idea of how you may go about creating an optimization performance budget. Thanks so much for listening to today's episode of Developer Tea. I hope this will help guide you when you begin to create your performance budget and I hope it will help you avoid the trap of over optimization and get the most return on the precious time that you're investing in these optimizations. Thank you so much again for listening and thank you once again to FreshBooks for sponsoring today's episode of Developer Tea, the ridiculously easy to use online accounting software that gets you paid faster. Thank you so much for listening. Of course, all the links from today's episode can be found at speck.fm. I want you to take just two minutes to go and subscribe to Developer Tea and whatever podcasting app you use. If you've been listening for a long time or if you're a brand new listener, now is the time to subscribe so you don't miss out on any future episodes of the show. Of course, if you are enjoying Developer Tea, please be sure to leave a review in iTunes. Not only does it help other developers just like you find Developer Tea, but it also helps the show out. When you leave a review, it helps the show climb in the iTunes ratings. If you believe Developer Teadeserves to climb in the ratings, then go and leave a quick review on iTunes. Thank you so much for your time today and for leaving those reviews. I read every single one of them and I appreciate those who have left reviews so much. Thank you so much and until next time, enjoy your tea.