Use time.Stopwatch in core:bytes benchmark

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.
This commit is contained in:
Feoramund
2025-05-29 16:08:39 -04:00
parent 4e49fb4f82
commit edbd247972

View File

@@ -54,14 +54,15 @@ run_trial_size :: proc(p: proc "contextless" ([]u8, byte) -> int, size: int, idx
accumulator: int
for _ in 0..<runs {
start := time.now()
accumulator += p(data, 'z')
done := time.since(start)
timing += done
}
watch: time.Stopwatch
timing /= time.Duration(runs)
time.stopwatch_start(&watch)
for _ in 0..<runs {
accumulator += p(data, 'z')
}
time.stopwatch_stop(&watch)
timing = time.stopwatch_duration(watch)
log.debug(accumulator)
return