<p>Hi Clément, </p>
<p> </p>
<p>I hope you may help me spare some tests !</p>
<p> </p>
<p>Regarding Scifunc blocks, in sciblk4, createblklist() uses vartosci(..) to reshape the inptr, yet it does only copy the adresses in a new table of pointers, not the actual data, isn't it? Do you thing this address copying is the time consumming operation ?</p>
<p> </p>
<p>I found 2 stranges things:</p>
<p>1) vartosci(..) creates a List with appends in a for loop, and the data is stored in a vector m_plData. That means each time the vector capacity is reached, it "<em>reallocates it in order to grow in size when new elements are inserted, which implies allocating a new array and moving all elements to it".<br /></em></p>
<p>Is a memory allocation strategy defined somewhere in Scilab for TList, List and Typed_list.<em><br /></em></p>
<p> </p>
<p>2) createblklist(...) creates a TList whose values are also stored in a vector container m_plData, which is also dynamically allocated and may be recreated each time capacity is reached, by the append method.</p>
<p> </p>
<p>Thus, in sciblk4, could we call <strong>static</strong> types::InternalType* pIT = createblklist(...) and in.push_back(pIT) only when flag is on initialization, so that all Lists are created once and only updated at each iteration ? Would it help ? That would require to rewrite vartosci() and createblklist() with a iterator approach instead of append.<span style="text-decoration: underline;"><br /></span></p>
<p> </p>
<p>Regards, </p>
<p>Eric</p>
<p> </p>
<p> </p>
<p> </p>
<p>> Message du 09/04/18 09:37<br />> De : "Clément David" <Clement.David@esi-group.com><br />> A : "dev@lists.scilab.org" <dev@lists.scilab.org><br />> Copie à : <br />> Objet : Re: [Scilab-Dev] New xcos blocks executing scilab primitive functions<br />> <br /><br /><br />> To call Scilab script within the sciblk2 [1] and sciblk4 [2] blocks we are indeed using the Scilab<br />> C++ API, <span style="text-decoration: underline;">the performance overhead is quiet clear as we are currently allocating Scilab types::Double</span><br /><span style="text-decoration: underline;">> or a types::MList through createblklist()</span> for each output on each simulation step.</p>