MCPcopy Create free account
hub / github.com/unrolled/render / BenchmarkSmallHTMLBuffers

Function BenchmarkSmallHTMLBuffers

render_html_test.go:89–105  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

87}
88
89func BenchmarkSmallHTMLBuffers(b *testing.B) {
90 b.ReportAllocs()
91
92 render := New(Options{
93 Directory: "testdata/basic",
94
95 // Tiny 8 bytes buffers -> should lead to allocations
96 // on every template render
97 BufferPool: NewSizedBufferPool(32, 8),
98 })
99
100 buf := new(bytes.Buffer)
101 for i := 0; i < b.N; i++ {
102 _ = render.HTML(buf, http.StatusOK, "hello", "gophers")
103 buf.Reset()
104 }
105}
106
107func TestHTMLXHTML(t *testing.T) {
108 render := New(Options{

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
NewSizedBufferPoolFunction · 0.85
HTMLMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…