Page 1 of 1
Lowering CPU usage, best methods
Posted: Mon Sep 23, 2019 7:34 pm
by BobF
Hello Gang,
If creating an effect or synth with say lots of knobs, selectors, switches, matrix and or cable patching, and other modules like, lots of oscillators, filters, ADSR's, wave shapers, and so on (not necessary all of these), what are some methods to keep CPU usage at it's lowest.
I have been playing around with an old Serge modular idea where anything can be patched to anything, and so far the idea does work (just experiments now), but CPU usage is as high as 5 to 10. This is fine on my computer because it's fast with 16 gigs of memory, but I would never think of releasing anything like it.
Thanks and hope to see lot's of answers for this one, BobF.....
Re: Lowering CPU usage, best methods
Posted: Mon Sep 23, 2019 11:27 pm
by martinvicanek
If you have larger parts of the schematic in green make sure to block all innecessary triggers. Do some testing: place a trigger counter at various points and see how many triggers are registered when you send in a single one.
if major calculations are done in stream or poly, consider hopping instead of updating at sample rate. Typical candidates are control signals, LFOs, even envelope generators.
Re: Lowering CPU usage, best methods
Posted: Fri Oct 04, 2019 6:29 pm
by HughBanton
hi Bob,
Other thing with stream/poly stuff is to avoid unneccessary processing & repeat calculations. Very often you can make use of stage(0) to calculate parameters just once at the start of a note or process, rather than repeating the calculations on every single sample - makes a massive difference.
In another thread (
viewtopic.php?f=4&t=23560&start=0) I recently established that in Assembler the ecx register - which in FS is used as the sample counter - always resets to zero whenever a new note is pressed (in any SSE group of 4), and this fact too can be used to isolate the very first pass of your code to great effect, similar to stage(0). Or to isolate
any cycle in fact, if you want to avoid everything trying to summon the cpu at the same time.
Another tip is to try to amalgamate DSP modules; I think I'm right in saying that every module-out and module-in connection is in reality a memory write and a memory read (I expect there's more to it ...) so if you can combine 2 modules into 1, or - why not - 3 or 4 or more into 1 you are avoiding umpteen memory accesses.
If you can get the hang of migrating DSP code to Assembler then there is invariably a massive cpu saving available by optimising the code, particularly substituting one of the 8 xmm registers (xmm0..xmm7) in place of variables - again avoiding memory accesses. And really satisfying when you get it to work - mental bonus! Go to Flowstone Guru site for all the good stuff with that.
I'm permanently on FS64 nowadays, and getting amazingly low cpu %ges and big polyphony. I have more tricks that you can now do only on FS64 if of interest
Hugh