for loop running time analysis
조회 수: 2 (최근 30일)
이전 댓글 표시
Profiler shows that "end" line takes a large part of the running time of for loop. Why? Do jump instructions really run longer than calculation process?
댓글 수: 0
채택된 답변
Walter Roberson
2020년 5월 15일
When MATLAB notices that patterns of code have been used that can be made more efficient by calling into the high-performance mathematically libraries such as MKL, then MATLAB does not execute the given code line-by-line, and it allocates the total time to the end-point of the section that it optimized. Also, the overhead of running the for loop is allocated against the end statement
댓글 수: 0
추가 답변 (1개)
rajat aggarwal
2020년 5월 15일
Yes jump statement takes more time then usual line and here in your case you are using end statement in a loop. Jump statement hinders the workflow of a program. Usually Program counter jumps from one position to another position and start executing the instruction stored there. It requires time. Therefore jump statements take more time than usual statemtents.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!