필터 지우기
필터 지우기

question on elapsed time

조회 수: 2 (최근 30일)
konoha
konoha 2016년 11월 22일
답변: Walter Roberson 2016년 11월 23일
I am working a problem that require to understand why each operation takes different time. So, I have a
A = randn(100,100);
b = randn(100,1);
tic; x = A\b; toc;
this operation takes about 0.002s
then I do
tic; x= A\b; toc;
MatLab takes slightly shorter times to do the calculation.
As I repeat for a few times, I keep getting two slightly different time. I don't understand why.

답변 (2개)

Star Strider
Star Strider 2016년 11월 23일
You are getting slightly different times because life is inherently stochastic.

Walter Roberson
Walter Roberson 2016년 11월 23일
  • You wiggled the mouse more and that took up some of the computer's attention
  • MATLAB does not invoke its garbage collection every time it does an operation, and the amount of time it takes to collect garbage is not constant
  • Your anti-virus kicked in for some reason
  • Your firewall spent a bit of time disregarding some attack packets from outside
  • Some background operation resulted in the data being moved out of the Level 1 cache of your CPU
  • Your operating system decided to schedule the work for a different processor and spent a moment moving the process
  • Your memory system spent a few jiffy fixing a single bit error
  • Your music player decided it was time to check with the mothership to see if a new version of itself was available
  • Sunspots
  • Because the wise and powerful and rich and wise weasel wished it so

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by