Skip to content

Instantly share code, notes, and snippets.

@ian-kent
Created August 3, 2017 10:54
Show Gist options
  • Save ian-kent/e2948b40e1c657eb52190c5821d7bad5 to your computer and use it in GitHub Desktop.
Save ian-kent/e2948b40e1c657eb52190c5821d7bad5 to your computer and use it in GitHub Desktop.
package log
import (
"testing"
stdlog "log"
)
func BenchmarkLog(b *testing.B) {
HumanReadable = false
for n := 0; n < b.N; n++ {
Debug("test", nil)
}
}
func BenchmarkStdLog(b *testing.B) {
for n := 0; n < b.N; n++ {
stdlog.Println("test test test test test test test test test test test test test test test")
}
}
go test -run=^$ -bench=. -cpuprofile=cpu.out
go tool pprof log.test cpu.out
from inside pprof - run 'pdf' command
then open output001.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment