From f8afa65d8681e6276fc01a28a4ea6c4aa37e2a65 Mon Sep 17 00:00:00 2001 From: Simon Eskildsen Date: Sat, 3 May 2014 20:30:30 -0400 Subject: [PATCH] test: remove temporary benchmarks --- logrus_test.go | 58 -------------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/logrus_test.go b/logrus_test.go index 7f1a009..96a66a2 100644 --- a/logrus_test.go +++ b/logrus_test.go @@ -3,9 +3,7 @@ package logrus import ( "bytes" "encoding/json" - "io/ioutil" "testing" - "time" "github.com/stretchr/testify/assert" ) @@ -100,59 +98,3 @@ func TestInfoShouldNotAddSpacesBetweenStrings(t *testing.T) { assert.Equal(t, fields["msg"], "testtest") }) } - -type SlowString string - -func (s SlowString) String() string { - time.Sleep(time.Millisecond) - return string(s) -} - -func getLogAtLevel(l Level) *Logger { - log := New() - log.Level = l - log.Out = ioutil.Discard - return log -} - -func BenchmarkLevelDisplayed(b *testing.B) { - log := getLogAtLevel(Info) - for i := 0; i < b.N; i++ { - log.Info(SlowString("foo")) - } -} - -func BenchmarkLevelHidden(b *testing.B) { - log := getLogAtLevel(Info) - for i := 0; i < b.N; i++ { - log.Debug(SlowString("foo")) - } -} - -func BenchmarkLevelfDisplayed(b *testing.B) { - log := getLogAtLevel(Info) - for i := 0; i < b.N; i++ { - log.Infof("%s", SlowString("foo")) - } -} - -func BenchmarkLevelfHidden(b *testing.B) { - log := getLogAtLevel(Info) - for i := 0; i < b.N; i++ { - log.Debugf("%s", SlowString("foo")) - } -} - -func BenchmarkLevellnDisplayed(b *testing.B) { - log := getLogAtLevel(Info) - for i := 0; i < b.N; i++ { - log.Infoln(SlowString("foo")) - } -} - -func BenchmarkLevellnHidden(b *testing.B) { - log := getLogAtLevel(Info) - for i := 0; i < b.N; i++ { - log.Debugln(SlowString("foo")) - } -}