Am I using the timing function correctly in my program? The timing values seem a bit off.

solved
Last edited on
It's good that you noticed that the numbers don't make sense. The problem is that you aren't setting etime before line 70.

By the way, you're actually measuring the time to create the arrays and write the first line about the amount of time it takes. it would be better to set etime right after the loops, before you do anything else.
you did not catch the last timestamp
line 69 etime = time(0);


> Am I using the TIME function wrong in my program?
I don't think that using a wall clock is a good idea to measure performance.
you'll want to check user-time instead (iirc clock() does that)

By the way
In function ‘void staticArray()’:
10:19: warning: iteration 999u invokes undefined behavior [-Waggressive-loop-optimizations]
1
2
  static double staticArr[999];
  for (int i = 0; i < 1000 /*999*/; i++)
Topic archived. No new replies allowed.