(b *testing.B)
| 73 | } |
| 74 | |
| 75 | func BenchmarkZapJSON(b *testing.B) { |
| 76 | additional := generateStringSlice(_sliceSize) |
| 77 | b.ResetTimer() |
| 78 | b.RunParallel(func(pb *testing.PB) { |
| 79 | for pb.Next() { |
| 80 | enc := NewJSONEncoder(testEncoderConfig()) |
| 81 | enc.AddString("str", "foo") |
| 82 | enc.AddInt64("int64-1", 1) |
| 83 | enc.AddInt64("int64-2", 2) |
| 84 | enc.AddFloat64("float64", 1.0) |
| 85 | enc.AddString("string1", "\n") |
| 86 | enc.AddString("string2", "💩") |
| 87 | enc.AddString("string3", "🤔") |
| 88 | enc.AddString("string4", "🙊") |
| 89 | enc.AddBool("bool", true) |
| 90 | _ = enc.AddArray("test", additional) |
| 91 | buf, _ := enc.EncodeEntry(Entry{ |
| 92 | Message: "fake", |
| 93 | Level: DebugLevel, |
| 94 | }, nil) |
| 95 | buf.Free() |
| 96 | } |
| 97 | }) |
| 98 | } |
| 99 | |
| 100 | func BenchmarkStandardJSON(b *testing.B) { |
| 101 | record := struct { |
nothing calls this directly
no test coverage detected