How do you time a function in Go and return its runtime in milliseconds?
Another easy way can be:
import ( "fmt" "time" ) start := time.Now() // some computation elapsed := time.Since(start) fmt.Println(elapsed)
which will output something like 359.684612ms
359.684612ms