Our algorithm – the dot product
We will use the dot product, also called the scalar product, as a straightforward algorithm to clearly demonstrate the concepts of performance optimization. The dot product of vectors provides information about the lengths and angles of vectors and is frequently used in ML applications. The dot product is a very easy calculation for teaching purposes. It also can be done in multiple ways and can take advantage of vector processing hardware. In fact, the Arm Cortex-A processors have special instructions to increase the performance of dot product computation (the Cortex-M processors, as of yet, do not).
Of course, in a realistic setting, your software algorithms will be more complex than a simple dot product. The same underlying principles of optimization will apply, however, as there are many ways to solve any given problem in software. Understanding how to compare these implementations quickly will enable effective system optimization.
As...