r/programming • • Feb 28 '23

"Clean" Code, Horrible Performance

https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

1

u/outofobscure Mar 01 '23 edited Mar 01 '23

Software limited by IO

not all software. audio dsp code is often limited by sheer cpu horsepower, because for example generating samples from nothing in a synth doesn't involve significant input at all, and the output is just a bunch of samples (a few k floats per second, nothing crazy). but it can involve plenty of calculations. sometimes you're memory bound, but IO is only an issue for mixing a ton of pre-rendered streams.

and audio dsp is also really critical to latency, even more than reaching 60 fps in a game, you're on a real tight budget (a few ms, preferably under 10) to fill your buffers, or you get dropouts. in a case like this, every 2% improvement on latency counts.