[Scilab-Dev] New xcos blocks executing scilab primitive functions
Eric GERNOT
gernot.eric at wanadoo.fr
Thu Apr 12 17:46:51 CEST 2018
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 Typed_list.
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.
Regards,
Eric
> Message du 09/04/18 09:37
> De : "Clément David"
> A : "dev at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20180412/3d8d47d1/attachment.htm>
More information about the dev
mailing list