avatar
MATLAB function call too slow# Programming - 葵花宝典
i*w
1
After I profiled my programe, I found that the most time consuming part (
self time) in a function f(...) is something like this:
[A,B,C]= g(x,A,B,C);
I'm wondering why this statement will be slow? Since it's self time of f(...
),
it's not the time within function g(...). Does this mean the time is
consumed in copying matrix parameters A,B,C ? How can I improve the
speed? Thanks a lot.
avatar
s*y
2
use C....

..

【在 i***w 的大作中提到】
: After I profiled my programe, I found that the most time consuming part (
: self time) in a function f(...) is something like this:
: [A,B,C]= g(x,A,B,C);
: I'm wondering why this statement will be slow? Since it's self time of f(...
: ),
: it's not the time within function g(...). Does this mean the time is
: consumed in copying matrix parameters A,B,C ? How can I improve the
: speed? Thanks a lot.

avatar
s*r
3
Global variables
avatar
n*d
4
You may need to look inside the function. For example, if you have a number
of nested 'for', 'while' loops, it's bound to be slow. Change those into
matrix operations if you can.
Rewriting it in C is a good idea, if speed is an issue. I got a nonlinear
filter function running at least 20 times faster after rewritting it in C.

【在 s****y 的大作中提到】
: use C....
:
: ..

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。