Measuring Performance
If we are going to learn about optimisation, we need to understand how to quantify the performance of our algorithms. All resources in a computer system are finite, but the ones that we usually care most about are time and memory1. Here, we will discuss various approaches of quantifying how many resources are required to perform a specific task.
As a general rule of thumb in Julia, one should only ever benchmark/profile code within a function, and not executed at global scope, this will give the most accurate results. This is inline with the performance tips of the language where all time sensitive code is put inside a function.
Measuring the runtime of a program can be done a few different ways. Here, we will talk about timing, benchmarking and profiling which are slightly different approaches to quantify the performance of an algorithm.
- For some cases, there are other concerns such as energy usage, storage requires etc.↩