代码拉取完成,页面将自动刷新
package wtflog_test
import (
"io"
"testing"
. "gitee.com/FlyingOnion/wtflog"
. "gitee.com/FlyingOnion/wtflog/types"
)
func BenchmarkJLog1Int(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(Int(1))
}
}
func BenchmarkJLog1int(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(1)
}
}
func BenchmarkJLog5Ints(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(Int(1), Int(2), Int(3), Int(4), Int(5))
}
}
func BenchmarkJLog5ints(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(1, 2, 3, 4, 5)
}
}
func BenchmarkJLog10Ints(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(Int(1), Int(2), Int(3), Int(4), Int(5),
Int(1), Int(2), Int(3), Int(4), Int(5))
}
}
func BenchmarkJLog10ints(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
}
}
// func BenchmarkJLog5Strings(b *testing.B) {
// l := New(WithWriter(io.Discard), WithLevel(LevelInfo))
// b.ResetTimer()
// for i := 0; i < b.N; i++ {
// l.Info(String("aaa"), String("bbb"), String("ccc"), String("ddd"), String("eee"))
// }
// }
func BenchmarkJLog5strings(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info("aaa", "bbb", "ccc", "ddd", "eee")
}
}
// func BenchmarkJ10Strings(b *testing.B) {
// l := New(WithWriter(io.Discard), WithLevel(LevelInfo))
// b.ResetTimer()
// for i := 0; i < b.N; i++ {
// l.Info(String("aaa"), String("bbb"), String("ccc"), String("ddd"), String("eee"),
// String("aaa"), String("bbb"), String("ccc"), String("ddd"), String("eee"))
// }
// }
func BenchmarkJLog10strings(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info("aaa", "bbb", "ccc", "ddd", "eee",
"aaa", "bbb", "ccc", "ddd", "eee")
}
}
func BenchmarkJLog1Struct(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
a := A{"S", 3, []B{{"A", []string{"a"}}}}
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(a)
}
}
func BenchmarkJLog5StructsWithoutGen(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
a := A{"S", 3, []B{{"A", []string{"a"}}}}
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(a, a, a, a, a)
}
}
func BenchmarkJLog5StructsWithGen(b *testing.B) {
l := NewJsonLogger().WithWriter(io.Discard)
a := AA{"S", 3, []BB{{"A", []string{"a"}}}}
b.ResetTimer()
for i := 0; i < b.N; i++ {
l.Info(a, a, a, a, a)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。