On Wed, Apr 28, 2021 at 1:23 PM IOhannes m zmölnig zmoelnig@iem.at wrote:
On 4/28/21 18:49, David Rush wrote:
Hi All -
I'm trying to figure out where to look in the code to try and understand the signal rate processing better. Specifically, I want to understand how the graph gets optimized
The thing is---in a single threaded process, it mostly doesn't matter what order you do things. Sure, you've still got the dependencies (e.g. put this object's perform routine on the chain, only after each other object that feeds into its inlets), but doing things in a different order doesn't mean doing fewer computations.
So, the main way that the process runs more optimally is to keep signals in the cache until the chain runs out of things to do with them. That means the graph is sorted and run depth first. Start with a node with no signals coming in, add its perform routine, and then proceed depth-first until you reach an object that doesn't have all its data. Then, go to the next node with no signals coming in and do the same thing.
Where should I start looking?
the core of the DSP-graph handling is in src/d_ugen.c
see also g_canvas.c The canvas has a "dsp" method that finds all the objects in the canvas with "dsp" methods, makes the list, and calls the ugen functions