MCPcopy
hub / github.com/valyala/fasthttp / BenchmarkCopyZeroAllocOSFileToStringsBuilder

Function BenchmarkCopyZeroAllocOSFileToStringsBuilder

http_timing_test.go:69–86  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

67}
68
69func BenchmarkCopyZeroAllocOSFileToStringsBuilder(b *testing.B) {
70 r, err := os.Open("./README.md")
71 if err != nil {
72 b.Fatalf("Failed to open testing file: %v", err)
73 }
74 defer r.Close()
75
76 w := &strings.Builder{}
77
78 b.ResetTimer()
79 for i := 0; i < b.N; i++ {
80 w.Reset()
81 _, err = copyZeroAlloc(w, r)
82 if err != nil {
83 b.Fatal(err)
84 }
85 }
86}
87
88func BenchmarkCopyZeroAllocIOLimitedReaderToOSFile(b *testing.B) {
89 f, err := os.Open("./README.md")

Callers

nothing calls this directly

Calls 4

copyZeroAllocFunction · 0.85
OpenMethod · 0.80
CloseMethod · 0.65
ResetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…