This should result in a clearer idea of how fast the procedures are running, as the loop can run without going back and forth to the system for the time.
@@ -54,14 +54,15 @@ run_trial_size :: proc(p: proc "contextless" ([]u8, byte) -> int, size: int, idx
accumulator: int
+ watch: time.Stopwatch
+
+ time.stopwatch_start(&watch)
for _ in 0..<runs {
- start := time.now()
accumulator += p(data, 'z')
- done := time.since(start)
- timing += done
}
+ time.stopwatch_stop(&watch)
- timing /= time.Duration(runs)
+ timing = time.stopwatch_duration(watch)
log.debug(accumulator)
return