[TextFormatter] Speed up. Fprintf is changed to buffer.Write*

As Fprintf is slower than buffer.WriteString, it's replaced
to faster call.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
This commit is contained in:
Anton Tiurin
2015-06-27 17:09:22 +03:00
parent 93a1736895
commit e35e0e00b8
2 changed files with 26 additions and 9 deletions
+10
View File
@@ -1,6 +1,7 @@
package logrus
import (
"fmt"
"testing"
"time"
)
@@ -45,6 +46,15 @@ var largeFields = Fields{
"entries": "yeah",
}
var errorFields = Fields{
"foo": fmt.Errorf("bar"),
"baz": fmt.Errorf("qux"),
}
func BenchmarkErrorTextFormatter(b *testing.B) {
doBenchmark(b, &TextFormatter{DisableColors: true}, errorFields)
}
func BenchmarkSmallTextFormatter(b *testing.B) {
doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields)
}