MATLAB R2022b applications/binaries in linux take longer to start.

2 次查看(过去 30 天)
I have been seeing this problem where when I build an application in MATLAB R2022b using Application Compiler, and try to launch it via terminal by doing ./'nameofApplication' it takes way longer than expected.
However when I launch the same .m file which is used to build the application in MATLAB, its almost instantaneous.
Any idea what might be happening ? can it be the MATLAB runtime or the shared libraries that takes longer to load when runnning it standalone vs in MATLAB as a .m file ?

采纳的回答

Dhruv
Dhruv 2023-9-21
Yes, it is possible that the MATLAB runtime or the shared libraries take longer to load when running a standalone MATLAB application/binary in Linux than when running the same .m file in MATLAB.
The reason is that when you run a standalone MATLAB application/binary, the MATLAB runtime and shared libraries have to be loaded into memory from scratch. Also, the MATLAB runtime has to initialize a number of things, such as the MATLAB workspace and the graphics system. All these factors can contribute to the process taking lot of time.
In contrast, when you run a .m file in MATLAB, the MATLAB runtime and shared libraries are already loaded into memory and initialized. This means that the .m file can start running much faster than a standalone MATLAB application/binary.
Here are some things you can do to try to reduce the startup time of standalone MATLAB applications/binaries in Linux:
  • Make sure that you are using the latest version of the MATLAB runtime and shared libraries.
  • If you are using the Application Compiler to build your applications, make sure that you are using the latest version of the compiler and that you are compiling your applications for the correct platform.
  • Try to reduce the size of your applications by removing any unnecessary code or resources.
I hope the above-mentioned suggestions will help reduce the delay time!
  1 个评论
Pratik Chachad
Pratik Chachad 2023-9-21
Hello Dhruv,
Thanks for your response! It now makes sense why it takes longer for a standalone application/binary to start while running .m file is almost instantaneous.
However here is my situation, I need to launch my applications/binaries within 4 secs as this is the requirment that needs to be satisfied by our project. On our older version of those applications which were built using R2012b, this requirment was met. However when we updated our scripts to 2022b from 2008b, seems like it does not meet that criteria any longer. So here are my follow-up questions.
  1. What change from MATLAB 2012b runtime (8.0) to 2022b runtime (9.13) might have caused this behavior ? The scripts have not changed other than updating functions that no longer exist.
  2. Is there a way of maybe pre-loading the shared libraries in the memory before starting the applications/binaries so that we don't have to load it each time ?
Will we helpful if you can help with these Questions.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by