test: remove temporary benchmarks

This commit is contained in:
Simon Eskildsen 2014-05-03 20:30:30 -04:00
parent a7c84e5d7d
commit f8afa65d86
1 changed files with 0 additions and 58 deletions

View File

@ -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"))
}
}