https://audio.dev/ -- @audiodevcon​

A More Intuitive Approach to Optimising Audio DSP Code - Guiding the Compiler Through Optimising Your Code for You - Gustav Andersson - ADC 2023

As audio developers we all want our code to be blazingly fast, DSP code in particular. But when reading up on how to optimise audio DSP code, it is easy to get sucked into a world of counting divisions, vector instructions, compiler intrinsics and inline assembly, and think: this is impossible. These are techniques with a very steep learning curve and that require deep technical knowledge of how CPUs and compilers work. The resulting code is also often difficult to read, maintain, and possibly less flexible, as direct inline assembly or intrinsics are often tied to specific cpu architectures.

This talk will present a completely different approach to optimising, one that is more intuitive and accessible, and doesn’t trade speed for readability and maintainability of the code - Simply let your compiler do the hard work for you!

Compilers today are immensely good at optimising code. The difference between an optimised and un-optimised build of the same code can be an order of magnitude, if not more. Still there are things we as programmers can do when we write our code, that affects the level to which the compiler can optimise it.

In this talk we will talk about techniques compilers use to optimise code, and how to write code in a way that enables the compiler to optimise it as efficiently as possible. We will show useful patterns, and anti-patterns, that facilitate or hinder optimisation respectively. We will discuss how to benchmark and measure code and different kinds of bottlenecks, i.e. cpu/memory/pipeline bound code, and how to get the compiler to tell us when it is not able to optimise efficiently.

We will go through a few case studies comparing the performance and generated assembly code, before and after optimisation techniques have been employed. We will also take a look at how using functions from the c++ standard library compares to writing your own functions.

The main focus will be on optimising small, tight loops of audio DSP code that generally run directly from cache. The focus will not be on optimising higher level architecture, memory layout or cache-friendliness.

The talk will come with a companion repository posted on github.
_

Gustav Andersson

Will code C++ and python for fun and profit. Developer, guitar player and electronic music producer with a deep fascination with everything that makes sounds in one form or another. Currently on my mind: modern C++ methods, DSP algos, vintage digital/analog hybrid synths.
_

Streamed & Edited by Digital Medium Ltd: https://online.digital-medium.co.uk
_

Organized and produced by JUCE: https://juce.com/
_

Special thanks to the ADC23 Team:

Sophie Carus
Derek Heimlich
Andrew Kirk
Bobby Lombardi
Tom Poole
Ralph Richbourg
Jim Roper
Jonathan Roper
Prashant Mishra

#adc #audiodev #dsp #audio #cpp