Why does my stand-alone created using the MATLAB Compiler take longer to start the first time?

10 views (last 30 days)
It takes longer to start my stand-alone application the first time it is run than consecutive runs. Also if I run the application some time later, it again takes longer the first time but becomes faster on consecutive runs. I would expect it to always start quicker after the first run.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Nov 2016
The time improvement is expected behavior and is an optimization done by the operating system. This behavior is typical of all programs. When a program starts, it needs to be loaded from a slow medium (hard disk), to a fast medium (RAM). When a program stops running, the code for the program is not removed immediately; instead it is removed when a page fault occurs:
Page fault
See also:
Locality of reference
Since a machine does not have infinite memory, the code in memory is removed once another program needs it. If you restart your compiled application immediately, the code is already in memory and does not need to be reloaded from disk, so it's fast. If it has already been removed from memory, then in needs to be reloaded from the disk.
This is all normal operating system behavior. For more detailed information, refer to literature regarding operating systems.

More Answers (0)

Categories

Find more on Manage Products in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!