mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
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:
@@ -54,14 +54,15 @@ run_trial_size :: proc(p: proc "contextless" ([]u8, byte) -> int, size: int, idx
|
|||||||
|
|
||||||
accumulator: int
|
accumulator: int
|
||||||
|
|
||||||
for _ in 0..<runs {
|
watch: time.Stopwatch
|
||||||
start := time.now()
|
|
||||||
accumulator += p(data, 'z')
|
|
||||||
done := time.since(start)
|
|
||||||
timing += done
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
log.debug(accumulator)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user