Skip to content

Instantly share code, notes, and snippets.

@yifan-gu
Created December 16, 2015 00:06
Show Gist options
  • Save yifan-gu/5b9321327ffabbd9a2d7 to your computer and use it in GitHub Desktop.
Save yifan-gu/5b9321327ffabbd9a2d7 to your computer and use it in GitHub Desktop.
bench time.now
$ go test -v -bench=.
testing: warning: no tests to run
PASS
BenchmarkTimenow 100000000 21.8 ns/op
package benchtime
import (
"testing"
"time"
)
func BenchmarkTimenow(b *testing.B) {
for i := 0; i < b.N; i++ {
time.Now()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment