mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-22 04:30:08 +00:00
benchmarks
This commit is contained in:
parent
86de7718cc
commit
7ba56300d7
@ -30,13 +30,15 @@ import codex/slots/backends/helpers
|
|||||||
import create_circuits
|
import create_circuits
|
||||||
|
|
||||||
template benchmark(benchmarkName: string, blk: untyped) =
|
template benchmark(benchmarkName: string, blk: untyped) =
|
||||||
|
var ts = 0.0
|
||||||
for i in 1..3:
|
for i in 1..3:
|
||||||
block:
|
block:
|
||||||
let t0 = epochTime()
|
let t0 = epochTime()
|
||||||
`blk`
|
`blk`
|
||||||
let elapsed = epochTime() - t0
|
let elapsed = epochTime() - t0
|
||||||
let elapsedStr = elapsed.formatFloat(format = ffDecimal, precision = 3)
|
ts = elapsed / i.toFloat
|
||||||
echo "CPU Time [", benchmarkName, "] ", elapsedStr, "s"
|
let elapsedStr = ts.formatFloat(format = ffDecimal, precision = 3)
|
||||||
|
echo "CPU Time [", benchmarkName, "] ", elapsedStr, "s"
|
||||||
|
|
||||||
proc setup(
|
proc setup(
|
||||||
circuitDir: string, name: string,
|
circuitDir: string, name: string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user