MATLAB Answers


Why does it take so long for Application Compiled exe to execute?

I have a Matlab GUI made with GUIDE that takes ~50 times longer to launch when I run the *.exe file directly from the "for_redistribution_files_only" directory after compiling it relative to the amount of time it takes me to run the same original .m Application in a full Matlab console window. Why does it take so long to execute? It takes ~50 times longer only the first time I run it after logging into the Windows 10 console (and its not being run while other startup processes are happening). Then if I close it and run it again, it takes only 5 times longer. Still way way slower than launching from Matlab console. I'm running a 4-core laptop that gets great marks from Matlab's bench (the 3rd fastest computer just faster than Xeon X5650 @ 2.67 GHz). Does it make a difference from a launching speed perspective if I install it in registry using the Installer.exe App generated from Application Compiler? The reason I default to using the App *.exe that comes directly out of Application Compiler is because to run the Installer.exe requires admin privledges, which is something that I do not have and difficult to obtain.


Sign in to comment.

1 Answer

Answer by Walter Roberson
on 23 May 2019
 Accepted Answer

The first time you run, it has to break out the CTF archive as well as everything else.
Each time you run it has to check the md5 or equivalent to the archives to validate them, and then start executing.
The execution process involves the same amount of initialization as starting up matlab itself.
MATLAB Compiler does not compile to machine code: it just preparses the code the same way that is done the first time in a session that matlab encounters the file. The actual execution of the parsed code is by the same execution engine used by interactive matlab.
Do not use MATLAB Compiler to speed up execution: the speed will be the same.
If you want to speed up execution of code you should use MATLAB Coder
If you have a compiled execute and you need faster startup then have a look at Production Server

  1 Comment

Sign in to comment.