One of the recurring tasks I see inside projects is performance tuning. The focus is on a database or queries at times but more often it is a code cleanup. We can dig into someone else’s (or our own) code after it has gotten unusable. However, we can also follow the best practices and make it easier on ourselves.
Performance Tuning Loops
The largest area of tuning opportunities is always going to be in the code that is repeated most often. Thus, loops and similar code constructs should be our first step in improving speed or reducing memory. There are a number of best practices to consider when reviewing the looped code. These suggestions include pulling everything out of the loop that is not needed (declarations, initializations, etc.) and avoiding the use of external resources.
It is not uncommon to put some of these “bad” practices into our code when we are brain-storming through a solution. That is where we need to be careful. The rush to implement a solution should not ignore patterns of success. Thus, this is an area where we can lean on habits if we have good ones.
This is just a piece of the recommendations we cover in this presentation. You will find that the items covered are not rocket science. Instead, we focus on getting into good habits and leaning on what we know. That will help us turn out higher quality code from the start and avoid refactoring nightmares.
The Mentor-Mastermind Group
This series comes from our mentoring/mastermind classes. These classes are virtual meetings that focus on how to improve our technical skills and build our businesses. The goals of each member vary. However, this diversity makes for great discussions and a ton of educational value every time we meet. We hope you enjoy viewing this series as much as we enjoy creating it. As always, this may not be all new to you, but we hope it helps you be a better developer. Drop us a line to find out when the next one is so you can join our group.
Slide Deck: General Performance Tuning