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

Function benchmarkTextTemplate

tests/templates_timing_test.go:97–109  ·  view source on GitHub ↗
(b *testing.B, rowsCount int)

Source from the content-addressed store, hash-verified

95}
96
97func benchmarkTextTemplate(b *testing.B, rowsCount int) {
98 rows := getBenchRows(rowsCount)
99 b.RunParallel(func(pb *testing.PB) {
100 bb := quicktemplate.AcquireByteBuffer()
101 for pb.Next() {
102 if err := textTpl.Execute(bb, rows); err != nil {
103 b.Fatalf("unexpected error: %s", err)
104 }
105 bb.Reset()
106 }
107 quicktemplate.ReleaseByteBuffer(bb)
108 })
109}
110
111func getBenchRows(n int) []templates.BenchRow {
112 rows := make([]templates.BenchRow, n)

Callers 3

BenchmarkTextTemplate1Function · 0.85
BenchmarkTextTemplate10Function · 0.85
BenchmarkTextTemplate100Function · 0.85

Calls 5

AcquireByteBufferFunction · 0.92
ReleaseByteBufferFunction · 0.92
getBenchRowsFunction · 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…