MCPcopy
hub / github.com/uber-go/zap / BenchmarkWriteSyncer

Function BenchmarkWriteSyncer

zapcore/write_syncer_bench_test.go:86–101  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

84}
85
86func BenchmarkWriteSyncer(b *testing.B) {
87 b.Run("write file with no buffer", func(b *testing.B) {
88 file, err := os.CreateTemp(b.TempDir(), "test.log")
89 require.NoError(b, err)
90
91 w := AddSync(file)
92 b.ResetTimer()
93 b.RunParallel(func(pb *testing.PB) {
94 for pb.Next() {
95 if _, err := w.Write([]byte("foobarbazbabble")); err != nil {
96 b.Fatal(err)
97 }
98 }
99 })
100 })
101}

Callers

nothing calls this directly

Calls 4

AddSyncFunction · 0.85
NextMethod · 0.80
WriteMethod · 0.65
FatalMethod · 0.45

Tested by

no test coverage detected