MATLAB可执行文件太慢 [英] MATLAB executable is too slow

查看:817
本文介绍了MATLAB可执行文件太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MATLAB中的deploytool将我的MATLAB程序转换为基于控制台的应用程序. MATLAB .m文件执行大约需要2秒钟,但是在将其转换为可执行文件并称为.exe之后,执行它需要45秒钟,这太长了.

我想将MATLAB程序与PHP集成在一起.是否有另一种高效快捷的方法来做到这一点?在我的项目中,时间确实是一个很大的因素(不是开发时间,而是应用程序的执行时间).那么有没有一种方法可以花费更少的时间呢?

我在Internet上看到我们可以编写PHP扩展来调用MATLAB.此方法快速还是与调用.exe文件相同? MATLAB编码器对此过程有帮助吗?如果有其他选择,请提及.

解决方案

MATLAB编译的.exe在首次运行时会产生开销,因为它正在启动MCR:加快编译应用的启动速度.

"为什么还报告了我使用MATLAB编译器创建的独立版本是否需要更长的时间才能开始?"还报告了连续运行应该更快,但是如果稍后重新运行,则必须将进程重新加载到内存中." >

您可以将代码封装在tic toc中,进行部署,并检查执行花费了多少时间,而又没有启动开销.

加快.exe速度的另一种方法是使用PHP调用MATLAB.如果您保持MATLAB会话为打开状态,则会遇到一次开销.您可以在启动时启动MATLAB,从而避免特别在使用PHP进行调用时承受开销.

有关更多信息,请阅读从PHP调用MATLAB ,并继续请注意,除非特别需要,否则您不想使用exit.

I converted my MATLAB program into a console-based application using the deploytool in MATLAB. The MATLAB .m file takes around 2 seconds to execute, but after I converted it into an executable and called the .exe, it takes 45 seconds to execute which is too long.

I want to integrate the MATLAB program with PHP. Is there another efficient and fast way to do this? In my project, time is really a big factor (not the developing time but the execution time of the application). So is there a method that takes less time?

I saw on the Internet that we can write PHP extensions to call the MATLAB. Is this method fast or the same as calling the .exe file? Is a MATLAB coder any help for this process? If there is an alternative option, please mention it.

解决方案

A MATLAB compiled .exe will suffer from overhead at the first time you run it becuase it is starting the MCR: Why does my application compiled with the MATLAB Compiler 4.1 take a long time to start up?

Unless you log off or restart your OS, the MCR will remain pre-loaded. Another useful read: Speeding up compiled apps startup.

"Why does my stand-alone created using the MATLAB Compiler take longer to start the first time?" also reports that consecutive runs should be faster, but if you rerun later, you will have to reload the process in memory.

You can enclose your code within tic toc, deploy it and check how much time the execution is taking, against startup overhead.

The alternative to speeding up the .exe would be to call MATLAB with PHP. If you keep the MATLAB session open you run into the overhead once. You could launch MATLAB at startup, thus avoiding to suffer the overhead specifically during the call with PHP.

For more info read Calling MATLAB from PHP, and keep in mind that you don't want to use exit unless specifically needed.

这篇关于MATLAB可执行文件太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆