MCPcopy
hub / github.com/valyala/quicktemplate / benchmarkMarshalXMLStd

Function benchmarkMarshalXMLStd

tests/marshal_timing_test.go:139–152  ·  view source on GitHub ↗
(b *testing.B, n int)

Source from the content-addressed store, hash-verified

137}
138
139func benchmarkMarshalXMLStd(b *testing.B, n int) {
140 d := newTemplatesData(n)
141 b.RunParallel(func(pb *testing.PB) {
142 bb := quicktemplate.AcquireByteBuffer()
143 e := xml.NewEncoder(bb)
144 for pb.Next() {
145 if err := e.Encode(d); err != nil {
146 b.Fatalf("unexpected error: %s", err)
147 }
148 bb.Reset()
149 }
150 quicktemplate.ReleaseByteBuffer(bb)
151 })
152}
153
154func BenchmarkMarshalXMLQuickTemplate1(b *testing.B) {
155 benchmarkMarshalXMLQuickTemplate(b, 1)

Callers 4

BenchmarkMarshalXMLStd1Function · 0.85
BenchmarkMarshalXMLStd10Function · 0.85

Calls 5

AcquireByteBufferFunction · 0.92
ReleaseByteBufferFunction · 0.92
newTemplatesDataFunction · 0.85
NextMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…