MATLAB: Does the first call after an idle time to MATLAB Compiler Runtime v713 (R2010a) take longer to return the results

MATLAB Compiler

I am working on a Windows machine. I observe that if my .NET application, created using MATLAB Builder NE generated component, has been idle for a while, I encounter the MATLAB Compiler Runtime startup overhead again.
For example, if I run the application for the first time at 12:00 noon, it takes about 3 minutes to return the results. On subsequent runs, the application takes about 20 seconds to return the results. If I re-run the application at 8:00 PM, it takes about 2 minutes to run. However, on subsequent runs, the application again takes about 20 seconds.
What happens to the MATLAB Compiler Runtime engine between 12:00 noon and 8:00 PM? Why is the application slow again, even when I did not shut down the MATLAB Compiler Runtime process?

Best Answer

The slow start of MATLAB Compiler Runtime based application is the effect of what Microsoft calls "after-lunch syndrome" :
The effect is even more pronounced on systems with lesser physical memory. Microsoft mitigates the after-lunch syndrome using Superfetch:
Based on the information about the after-lunch syndrome and superfetch, one could argue that MCR's slow response after a period of inactivity is because superfetch swapped out the physical memory pages.
To reduce the first-time startup overhead, try using .NET remoting, which should mitigate the first-run MCR startup time.