<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Perform routine: overhead and variable instantiation]]></title><description><![CDATA[<p>Hi all,<br />
in debugging some external code for Pd I happened to think about a thing I don't understand: each time the &quot;perform&quot; routine is called, the variables that are initialized are each time freshly initiated (they do not retain values from the past round) but they are always instantiated at the same memory address: is this for chance or is it by design?<br />
How much does it cost in terms of overhead to instantiate new variable at each dsp cycle? Here for instance: at every cycle some vars and arrays are instantiated:</p>
<p>void foo_tilde_perform(t_int *w, const int offset)<br />
{<br />
t_foo_tilde *x = (t_foo_tilde*) (w[1]);<br />
int n = (int)(w[2]);<br />
t_float *out[DEFAULT_AUDIO_CHANNELS];<br />
const int channels;<br />
int i = 0;<br />
int j = 0;</p>
<p>...</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7385/perform-routine-overhead-and-variable-instantiation</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 15:48:52 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/7385.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 May 2013 13:10:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Perform routine: overhead and variable instantiation on Thu, 09 May 2013 13:10:49 GMT]]></title><description><![CDATA[<p>Hi all,<br />
in debugging some external code for Pd I happened to think about a thing I don't understand: each time the &quot;perform&quot; routine is called, the variables that are initialized are each time freshly initiated (they do not retain values from the past round) but they are always instantiated at the same memory address: is this for chance or is it by design?<br />
How much does it cost in terms of overhead to instantiate new variable at each dsp cycle? Here for instance: at every cycle some vars and arrays are instantiated:</p>
<p>void foo_tilde_perform(t_int *w, const int offset)<br />
{<br />
t_foo_tilde *x = (t_foo_tilde*) (w[1]);<br />
int n = (int)(w[2]);<br />
t_float *out[DEFAULT_AUDIO_CHANNELS];<br />
const int channels;<br />
int i = 0;<br />
int j = 0;</p>
<p>...</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7385/perform-routine-overhead-and-variable-instantiation</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7385/perform-routine-overhead-and-variable-instantiation</guid><dc:creator><![CDATA[leopard86]]></dc:creator><pubDate>Thu, 09 May 2013 13:10:49 GMT</pubDate></item><item><title><![CDATA[Reply to Perform routine: overhead and variable instantiation on Thu, 09 May 2013 19:05:31 GMT]]></title><description><![CDATA[<p>This is just an issue of scope. If you simplify everything and just think of it as your typical &quot;learning C&quot; example, you can think of Pd itself as like the main{} function, and the functions in your object are like the ones that get declared outside of main{}. When you call those functions, the variables are not in the same scope as main{}. They are just local to the function. So once that function is called and finished, those values are lost.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/7385/perform-routine-overhead-and-variable-instantiation/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/7385/perform-routine-overhead-and-variable-instantiation/2</guid><dc:creator><![CDATA[Maelstorm]]></dc:creator><pubDate>Thu, 09 May 2013 19:05:31 GMT</pubDate></item></channel></rss>