Hi Clément, 


I hope you may help me spare some tests !


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 ?


I found 2 stranges things:

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 "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".

Is a memory allocation strategy defined somewhere in Scilab for TList, List and 


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.


Thus, in sciblk4, could we call static 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.







> Message du 09/04/18 09:37
> De : "Clément David" 
> A : "dev@lists.scilab.org" 
> Copie à : 
> Objet : Re: [Scilab-Dev] New xcos blocks executing scilab primitive functions

> To call Scilab script within the sciblk2 [1] and sciblk4 [2] blocks we are 
> indeed using the Scilab
> C++ API, the performance overhead is quiet clear as we are currently 
> allocating Scilab types::Double
> or a types::MList through createblklist() for each output on each simulation 
> step.
dev mailing list

Reply via email to