Skip to content

Instantly share code, notes, and snippets.

@Hebo
Created September 26, 2013 23:58
Show Gist options
  • Select an option

  • Save Hebo/6722291 to your computer and use it in GitHub Desktop.

Select an option

Save Hebo/6722291 to your computer and use it in GitHub Desktop.
package main
import (
"testing"
"time"
)
func BenchmarkAfter(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
<-time.After(1 * time.Millisecond)
}
}
func BenchmarkSleep(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
<-time.After(1 * time.Millisecond)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment