most time-consuming lines are self-time

조회 수: 9 (최근 30일)
Chaoyang Jiang
Chaoyang Jiang 2018년 7월 2일
편집: Adam Danz 2018년 7월 2일
I did the profile of the code, and it seems the most time-consuming lines are self-time (as attached). At this case, may I know what is a right way to reduce the running time?
Thank you.
  댓글 수: 1
Adam Danz
Adam Danz 2018년 7월 2일
편집: Adam Danz 2018년 7월 2일
You have almost 2 million calls to the first line of code listed and at least a million calls to the 2nd and 3rd lines. You must be doing something in a loop which could be evaluated for simplicity. A very fast function that consumes 50ms run 1 million times would accrue to nearly 14 hours. Looking at this screenshot doesn't provide much information as to how your code is structured.
As for reducing overhead time, see this comment which discusses the tradeoff of reducing overhead and potentially reducing readability.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by