<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Whoa!</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>I wonder - this was a libpd app I made, and it definitely made a difference putting all the DSP on one layer, but it was complex and I may have missed a trick here. It runs on an iPhone, and I wonder if there is a difference in how that works. resolving abstractions and subpatches with audio dropped the CPU load on an iPhone 4 from 132% to 71%.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style:
 normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>Unless teh people writing the GUI fixed a big bad bug without telling me? I didn't seem like that at the time...if it wasn't the case I could have saved myself some pain.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>Cheers,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;">Ed</div><div></div><div>&nbsp;</div><div>Ninja Jamm - a revolutionary new music remix app from Ninja Tune and Seeper,
 for iPhone and iPad<br>http://www.ninjajamm.com/</div><div><br><br></div><div>Gemnotes-0.2: Live music notation for Pure Data, now with dynamics!<br>http://sharktracks.co.uk/&nbsp;</div><br> <div><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Charles Z Henry &lt;czhenry@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Roman Haefeli &lt;reduzent@gmail.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> pd-list &lt;pd-list@iem.at&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, 7 August 2013, 21:48<br> <b><span style="font-weight: bold;">Subject:</span></b> Re:
 [PD] How to reduce CPU use on unused subpatches-abstracts?<br> </font> </div> <div class="y_msg_container"><br><div id="yiv0484010793"><div dir="ltr"><br><div class="yiv0484010793gmail_extra"><br><br><div class="yiv0484010793gmail_quote">On Wed, Aug 7, 2013 at 2:57 AM, Roman Haefeli <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:reduzent@gmail.com" target="_blank" href="mailto:reduzent@gmail.com">reduzent@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="yiv0484010793gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="yiv0484010793HOEnZb"><div class="yiv0484010793h5">On Wed, 2013-08-07 at 08:40 +0200, IOhannes m zmölnig wrote:<br>
&gt; On 08/07/13 03:15, Miller Puckette wrote:<br>
&gt; &gt; Hmmm... &nbsp;I was umnder the impression that, except for the overhead of block~<br>
&gt; &gt; and switch~ objects, there would be no difference in DSP execution time<br>
&gt; &gt; between a patch having lots of subpatches and one with the same amount of<br>
&gt; &gt; computation all thrown in one window. &nbsp;I haven't made any measurements but<br>
&gt; &gt; theoreticall at least there shouldn't be any difference.<br>
&gt;<br>
&gt; i once did make measurements, and they showed that your assumption is<br>
&gt; correct.<br>
&gt;<br>
&gt; or at least, it showed that it *was* correct at that time. this was on a<br>
&gt; P2-400MHz in 1998 or so, where a 16 channel spatialization patch would<br>
&gt; eat about 95% of the CPU - regardless of whether you used a single huge<br>
&gt; patch or organized the code into subpatches/abstractions.<br>
&gt;<br>
&gt; eventually i went for using abstractions, and let the PC run at 95% for<br>
&gt; the 2 weeks show.<br>
<br>
</div></div>I once made some informal tests to measure the overhead of [switch~]. It<br>
turned out it is quite big and if you're running hundreds or thousands<br>
instances of [switch~] you probably gain nothing by turning DSP off in<br>
subpatches. I don't know what the sweet spot is it seems using [switch~]<br>
is only worth for subpatches with a minimum amount of (DSP) complexity.<br>
<span class="yiv0484010793HOEnZb"><font color="#888888"><br>
Roman</font></span><br></blockquote><div><br></div><div>I don't know why this is so...&nbsp;&nbsp; <br>When you add a [switch~] object, it adds a prologue and epilogue around the perform routines from each object in the subpatch.&nbsp; The runtime behavior is just like [block~], except when the patch is switched off, the switch prologue returns a pointer to the epilogue, instead of the next item in the dsp chain (don't quote me--I may need to read some code to find exact behavior, but that's the gist of it).<br>
<br></div><div>To me, this is pretty minimal and reasonable.&nbsp; Maybe there's an unintended consequence like cache misses when skipping over part of the dsp chain.<br></div><div><br></div><div>&nbsp;Chuck</div></div></div></div></div><br>_______________________________________________<br><a ymailto="mailto:Pd-list@iem.at" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br><br><br></div> </div> </div> </blockquote></div>  </div></body></html>