Subpatches vs Abstractions

From a pd point of view which one is preferred regarding consumption of resources:
i.e is it a better design approach to organise a patch with a series of subpatches or a bunch of abstractions. Is one approach more cpu intensive than the other?

An example for when I would use abstractions over subpatches is when I reuse the same abstraction/subpatch many times in a patch. The reason to do that is that when you change something in an abstraction and saves it, it will be changed and saved in all the other versions of the same abstraction. That could for example be a granular player where you maybe have 50 grains, each consist of the same little algo. If you used subpatch and want to change something you would have to change it in all 50 subpacthes. If using abstractions, you only have to change it in one of them, save it and it will be changed in the other 49 versions of it. Alor simpler than going into all 50 of the 50 subpatches and changing it manually.

But for many one time uses, for smaller project, where I dont have to reuse a lot, I prefer to use subpatches. The reason for that is, that you have less dependencies to external stuff outside the patch, like files on disc. Abstractions have to be saved somewhere, subpatches are embedded into the patch and make it easier to copy patches and so on.

Those are my reasons to use one thing over the other. Other people probably have other reasons.

I dont think there are any difference in CPU usage. but I am not 100% sure about that.

1 Like

theres no real performance overhead/benefit either way (afaik), all loaded into the same process space, run on same thread etc.

as @Jaffasplaffa said most of the time its about code reuse or not.

for more ‘advanced use’ ,
abstractions are needed for passing parameters, pd~ , dynamic loading, clone (next pd update :wink: )
you’ll need to use sub-patches, if you want to dynamically rewrite a patch.

I tend to use abstractions (mainly for parameter passing), unless I just want to tidy up a big patch - but I don’t stress about it, since its so quick to convert one to the other.

(hopefully one day, PD will get Max/MSPs UI shortcut, which creates subpatches auto-magically :slight_smile: )

1 Like