benchmarks

This commit is contained in:
Jaremy Creechley 2024-04-24 17:40:55 +03:00
parent 86de7718cc
commit 7ba56300d7
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
1 changed files with 4 additions and 2 deletions

View File

@ -30,13 +30,15 @@ import codex/slots/backends/helpers
import create_circuits
template benchmark(benchmarkName: string, blk: untyped) =
var ts = 0.0
for i in 1..3:
block:
let t0 = epochTime()
`blk`
let elapsed = epochTime() - t0
let elapsedStr = elapsed.formatFloat(format = ffDecimal, precision = 3)
echo "CPU Time [", benchmarkName, "] ", elapsedStr, "s"
ts = elapsed / i.toFloat
let elapsedStr = ts.formatFloat(format = ffDecimal, precision = 3)
echo "CPU Time [", benchmarkName, "] ", elapsedStr, "s"
proc setup(
circuitDir: string, name: string,