Python package created using Matlab Compiler taking long time to start execution
4 views (last 30 days)
Show older comments
Sree hari on 13 Sep 2016
Answered: Chetan Rawal on 14 Sep 2016
We have created a python package out of matlab code using Matlab Compiler, which exposes one function which is called from within a web app written in python. We found on close inspection that there is a significant time (~4 seconds) delay between the webapp making the call the to the python function in the python package created by the compiler and the first statement in the matlab code getting executed. The main matlab function itself executes fairly fast once it starts execution, but the initial delay is presenting a bottleneck. Is it some sort of runtime initialization ? But if at all that is the case , shouldn't it be just one once during the first call ? The delay happens for us on each call.
Why would this happen ? Could we be missing anything in terms of configuration or something ?
Environment : The python package is created using Matlab Compiler installed on a Linux box, and is also deployed on a Linux box. We dont use parallel pools yet.
Chetan Rawal on 14 Sep 2016
The delay is due to MATLAB Runtime startup time. If you can keep the MATLAB Runtime running on the server between calls, you won't see the delay. Tips: http://undocumentedmatlab.com/blog/speeding-up-compiled-apps-startup
Find more on Python Package Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!