<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>here's an alternative implementation which uses no additional memory allocations but is more invasive: https://github.com/pure-data/pure-data/pull/347
<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 06. April 2018 um 14:41 Uhr<br/>
<b>Von:</b> "Jonathan Wilkes via Pd-list" <pd-list@lists.iem.at><br/>
<b>An:</b> pd-list@lists.iem.at, "Dan Wilcox" <danomatika@gmail.com><br/>
<b>Betreff:</b> Re: [PD] suggestion: $0 in messages</div>

<div name="quoted-content">
<div style="font-family: Helvetica Neue , Helvetica , Arial , sans-serif;font-size: 13.0px;">
<div class="ydp2011be50yahoo_quoted" id="ydp2011be50yahoo_quoted_3997065447">On Friday, April 6, 2018, 6:24:13 AM EDT, Giulio Moro via Pd-list <pd-list@lists.iem.at> wrote:
<div style="font-family: "Helvetica Neue" , Helvetica , Arial , sans-serif;font-size: 13.0px;color: rgb(38,40,42);">
<div> </div>

<div> </div>

<div>
<div>> I don't think it makes sense to have a malloc() and free() for each call to a msg box.<br clear="none"/>
> Pd is already not very real-time friendly, why make it worse?<br clear="none"/>
> There could be ...<br clear="none"/>
> - statically allocated memory for t_gstack y in pd_pushsym</div>

<div> </div>

<div>But you can nest arbitrarily deep in patch loading, no?</div>

<div> </div>

<div>Also, patch loading time typically doesn't need to happen in realtime, as</div>

<div>you're also allocating memory for objects during that time plus probably</div>

<div>taking an i/o hit when loading abstractions.</div>

<div> </div>

<div>On the other hand, it would be interesting to use a memory pool like you</div>

<div>mention below and see its effect on load time. At least for the "canvas" field</div>

<div>of data structures in Purr Data I cache the binbuf so there's no i/o hit</div>

<div>there, only memory allocations.</div>

<div><br clear="none"/>
> - a pre-allocated memory pool meant for short-lived memory allocations to be used in real-time critical cases like this. If no memory available from the pool, only then allocate it (or allocate a new pool). There are probably other cases around the codebase where this would make sense, but why not starting with this?</div>

<div> </div>

<div>I'd measure performance here first to determine the best course of action.</div>

<div>Even with a memory pool pd_pushsym is doing quite a few assignments. Pushing</div>

<div>and popping on every msg box method may get be noticeably different than</div>

<div>dereferencing a single cached value.</div>

<div> </div>

<div>Measuring [trigger] performance I could see differences depending on how</div>

<div>exactly the loop for the outlets was constructed.</div>

<div> </div>

<div>-Jonathan</div>

<div><br clear="none"/>
> Giulio<br clear="none"/>
<br clear="none"/>
On Thursday, 5 April 2018, 22:54:44 BST, Jonathan Wilkes via Pd-list <<a href="mailto:pd-list@lists.iem.at" onclick="parent.window.location.href='pd-list@lists.iem.at'; return false;" target="_blank">pd-list@lists.iem.at</a>> wrote:<br clear="none"/>
<br clear="none"/>
> On Thursday, April 5, 2018, 3:20:03 PM EDT, Dan Wilcox <<a href="mailto:danomatika@gmail.com" onclick="parent.window.location.href='danomatika@gmail.com'; return false;" target="_blank">danomatika@gmail.com</a>> wrote:<br clear="none"/>
<br clear="none"/>
> test? <a href="https://github.com/pure-data/pure-data/pull/346" target="_blank">https://github.com/pure-data/pure-data/pull/346</a><br clear="none"/>
<br clear="none"/>
That will add a malloc/free for every method call to a msg box. So<br clear="none"/>
I'd measure the performance impact before using that<br clear="none"/>
implementation.<br clear="none"/>
<br clear="none"/>
On the l2ork dev list I mentioned a potential way to cache the glist<br clear="none"/>
in the t_messresponder to avoid allocation at message evaluation time.<br clear="none"/>
But we haven't implemented that yet (nor measured the current<br clear="none"/>
performance hit).<br clear="none"/>
<br clear="none"/>
-Jonathan<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
--------<br clear="none"/>
Dan Wilcox<br clear="none"/>
@danomatika<br clear="none"/>
danomatika.com<br clear="none"/>
robotcowboy.com<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
<br clear="none"/>
_______________________________________________<br clear="none"/>
<a href="mailto:Pd-list@lists.iem.at" onclick="parent.window.location.href='Pd-list@lists.iem.at'; return false;" target="_blank">Pd-list@lists.iem.at</a> mailing list<br clear="none"/>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" target="_blank">https://lists.puredata.info/listinfo/pd-list</a>

<div class="ydp2011be50yqt5107417577" id="ydp2011be50yqtfd20167"><br clear="none"/>
<br clear="none"/>
<br clear="none"/>
_______________________________________________<br clear="none"/>
<a href="mailto:Pd-list@lists.iem.at" onclick="parent.window.location.href='Pd-list@lists.iem.at'; return false;" target="_blank">Pd-list@lists.iem.at</a> mailing list<br clear="none"/>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" target="_blank">https://lists.puredata.info/listinfo/pd-list</a><br clear="none"/>
<br clear="none"/>
_______________________________________________<br clear="none"/>
<a href="mailto:Pd-list@lists.iem.at" onclick="parent.window.location.href='Pd-list@lists.iem.at'; return false;" target="_blank">Pd-list@lists.iem.at</a> mailing list<br clear="none"/>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" target="_blank">https://lists.puredata.info/listinfo/pd-list</a></div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" target="_blank">https://lists.puredata.info/listinfo/pd-list</a></div>
</div>
</div>
</div></div></body></html>