Info

此问题已关闭。 请重新打开它进行编辑或回答。

End statement constitutes 28s of execution time...options?

1 次查看(过去 30 天)
I have some object oriented MATLAB functions running through several iterations over tiles of an image. I profiled the code to optimize for testing on a set of 3800+ images. The issue is that the profiler tells me that 1 simple end statement with a comment afterwards is taking 28s of the 150s total execution time, being parsed 357,000+ times. All appropriate code optimizations have been made. This similarly occurs in another function, consuming 8 more seconds in 706,000+ parsings...Additionally, an if statement with 4 clauses consumes 13s with the same number of parsings.
Firstly, I don't understand how an end statement being parsed nearly twice as many times is nearly 4 times faster to parse than another end statement. Secondly, how has Mathworks not found a solution to this issue...?
Is the parsed characteristic of MATLAB code execution really introduce such terrible overhead? Are there any settings I can change? I'm avoiding the use of MEX files if possible. Looking to not run 3800 tests over 7 days...
Thanks in advance, Vlad

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by