SynthstromAudible / DelugeFirmware

https://synthstromaudible.github.io/DelugeFirmware/
GNU General Public License v3.0
565 stars 94 forks source link

Performance/note on speed #2199

Closed m-m-adams closed 3 months ago

m-m-adams commented 3 months ago

Improve the speed of note ons by marking the happy path (no arp, no probability, no failures as happy to improve caching

Lower the impact of note ons by not rendering the voice in the same window that the note was created in

Combine for a 10%ish reduction in window size during note ons for synth voices, both changes are about half of that independently. Multisamples are improved enough to play an extra voice in the same render length.

Synth before (66 default voice note ons):

image

After:

image

Multisample before (29 multisampled piano note ons):

image

Multisample after:

image
github-actions[bot] commented 3 months ago

Test Results

48 tests  ±0   48 :white_check_mark: ±0   0s :stopwatch: ±0s  9 suites ±0    0 :zzz: ±0   9 files   ±0    0 :x: ±0 

Results for commit 0db04ad3. ± Comparison against base commit 99281139.

nikodemus commented 3 months ago

I assume the mispredictions from [[unlikely]] are noise compared to the real costs of the unhappy paths?

m-m-adams commented 3 months ago

Yeah I've attempted to only put them in places where the unlikely path is fast enough to not need caching. Like calculating probability and iterations is common but only changes the next branch if the note ends up not sounding, in which case it's fast anyway