You might be wondering how we will detect bottlenecks such as these ones in our application. We all know that not all developers will take such low-level details into account, and even if they do, they might forget to do it in some critical code that the program needs to run many times in a row. We cannot check the whole code base manually but, fortunately, there are some profiling tools that will give us information about our software.
Profiling tools
Valgrind
Let's first start with a tool that will help you find where your software spends more time. Valgrind is a tool that helps to find bottlenecks. Two main tools inside Valgrind will give us the statistics we need to find out where to improve our code. It...