Compiled App running extremely slow in the MATLAB runtime environment
45 次查看(过去 30 天)
显示 更早的评论
Hello
I composed a code on Ubuntu Desktop 22.04LTS using Matlab R2024a, and it takes 236 seconds to execute.
Then i compiled it into a linux app and install Matlab runtime 2024a on the same computer (bare metal, not virtual machine, i7-6790K, 16GB RAM),
but the app executed extremely slow with the Matlab runtime, after serveral loops, its outputs seens stopped, but the thread is still running.
I didn't using Parallel Computing Toolbox in my code.
3 个评论
Andreas Goser
2024-7-29
In general, you can expect very similar execution times in MATLAB and the compiled application in the runtime.
Have you tried isolating the issue? Does it happen only in R2024a? Did you test it with a simple application rather than yours?
回答(1 个)
Shubham
2024-9-12
编辑:Shubham
2024-9-12
Hey Xin,
I understand that the compiled application is having higher execution time as compared to the native MATLAB scripts.
As stated by @Andreas Goser, MATLAB and the compiled application executed via the runtime should perform with similar execution time in most of the cases. However, please note that once the application is compiled as a standalone executable, it would be treated as any other application running over your OS.
There could be mutiple reasons for the slow execution of the compiled app:
- Sometimes the application could be blocked by other services running over your system. For instance, the antivirus service you are using could be considering the deployed application as a malware: https://www.mathworks.com/matlabcentral/answers/379849-how-to-unblock-a-deployed-application-blocked-by-antivirus
- Your application could be running slowly for the first run, but with the subsequent runs the execution time may get better. The slow execution of the application for the first time is because the standalone application requires to initialize MCR and load your application from a slow medium (hard disk), to a fast medium (RAM). Have a look at the following MATLAB Answer where a user faced slowdown for the very first run only: https://www.mathworks.com/matlabcentral/answers/1734820-compiled-application-is-very-slow
- After the release of R2014, The new MCR is essentially a trimmed down version of MATLAB that is started with each call to a compiled application. This causes slow startup of the compiled application. For more information regarding this issue, check out the following MATLAB Answer post: https://www.mathworks.com/matlabcentral/answers/100607-why-does-my-application-compiled-with-the-matlab-compiler-4-1-r14sp1-take-a-long-time-to-start-up
I hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with MATLAB Compiler 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!