Is std/monotimes the preferred method for quick benchmarking of nim code? e.g. if I want to compare to different implementations of an algorithm is this a useful quick and dirty approach?
import std/monotimes
var t0 = getMonoTime()
r = fxn1(....)
var t1 = getMonoTime()
echo "fxn1: "
echo t1-t0
t0 = getMonoTime()
r = fxn2(....)
t1 = getMonoTime()
echo "fxn2: "
echo t1-t0
The monotimes module seems to be quite new, I wasn't aware of it.
Looking into the implementation, yes it should work OK.
Otherwise you can use criterion (it's archived but pretty much finished) or roll your own with cpuTime / monotimes in a couple of lines.