Function for more scripts slower?
Mostrar comentarios más antiguos
Hi, I have a function that is used in different scripts. I would know if is more time saving changing the name of the function and use for each script different functions.
I'm worried about the fact that if one function is opened in a script, the other script have to wait that the function is closed to open again the same function and in this way the computational time gets longer.
Thanks.
2 comentarios
" I would know if is more time saving changing the name of the function and use for each script different functions."
No. That would just make managing your code more difficult and slow your code down.
"I'm worried about the fact that if one function is opened in a script, the other script have to wait that the function is closed to open again the same function and in this way the computational time gets longer."
MATLAB functions are not "opened" or "closed" when they are run (and certainly not individually each time they are called). MATLAB code is compiled and stored in memory: it makes no difference after that how many times it is called or from where. Your proposal (of making multiple copies of a function) would slow down your code because every function would need to be compiled separately (thus also pointlessly wasting memory):
So far I do not see any single advantage in what you are proposing.
Antonio Boccamazzo
el 11 de Abr. de 2019
Respuestas (0)
Categorías
Más información sobre Application Deployment en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!