Skip to content

Optimizing plug ins

p0nce edited this page Jul 17, 2024 · 7 revisions

Optimized plug-ins go several times the speed of unoptimized ones, sometimes one order of magnitude difference. However, it is very easy to break sound quality with a failed optimization that gave a +2% speed-up. How to optimize plugins reliably?

Optimizing UI (Windows)

➡️➡️➡️ Use the integrated UI trace profiler and watch it first. ⬅️⬅️⬅️

Older method:

STEP 1 Choose a sampling profiler of your choice:

Examples:

STEP 2

Build a VST 2.4 64-bit plugin with debug information.

$ dplug-build -b release-debug -a x86_64 --compiler ldc2 --combined

STEP 3

Open the plugin in one host.
Run measurement on the sampling profiler, while performing the behaviour you want to measure in your host. Stop the sampling and find bottlenecks in the whole plug-in operation.

Optimizing DSP code reliably

STEP 1

Maybe do not consider optimizing too much before your product is done and sounding great.
It seems optimization really is best left as a "last" steps. One reason is that one will have many presets to test with, so that improves the safety of optimizations a lot.

STEP 2

Setup the tools/bench configuration file in your plugin directory. Its help will provide you a starter bench.xml. This tool uses tools/wav-compare and tools/process as subprocesses.

Configure the <baseline> to be the original plugin.
Configure the <challenger> to be the last plugin built.

STEP 3

Once you've attempted an optimization, validate the results by using: $ bench [--force]

This will give you the speed-up or slowdown over a range. Consider the worst sound change and the minimum or median speed change before validating the optimization.

If you have any doubts, listen to them. tools/abtest can usually clear up doubts.