mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +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
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user