Unity DSP Performance Test

Jakob Schmid
Sep 8, 2018 · 1 min read

I have performed a series of tests for different approaches to sine computation, the goal being to evaluate the relative performance of different approaches to DSP code for use in Unity. This is relevant for anyone who wants to write realtime software synthesizers and effects for Unity games. The example used is a simple algorithm that computes a sum of sines using different approaches: library functions, polynomial approximation, and lookup tables of different sizes.

The key result of the tests was:

C# in Unity with the IL2CPP scripting backend performs comparably to C++,

which indicates that C# could be viable for implementing DSP code.

The following graph shows the performance of 4 different sine computation algorithms (lookup tables are the fastest), implemented using C++ and C# with different scripting backends:

In Unity PlayerSettings, the IL2CPP scripting backend is enabled here:

Unity Player Settings: IL2CPP

You can read the full article and review the source code at github.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade