MCPcopy
hub / github.com/labstack/echo / BenchmarkAllocJSON

Function BenchmarkAllocJSON

context_test.go:51–64  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

49}
50
51func BenchmarkAllocJSON(b *testing.B) {
52 e := New()
53 e.Logger = slog.New(slog.DiscardHandler)
54 req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(userJSON))
55 rec := httptest.NewRecorder()
56 c := e.NewContext(req, rec)
57
58 b.ResetTimer()
59 b.ReportAllocs()
60
61 for i := 0; i < b.N; i++ {
62 c.JSON(http.StatusOK, testUser)
63 }
64}
65
66func BenchmarkAllocXML(b *testing.B) {
67 e := New()

Callers

nothing calls this directly

Calls 3

JSONMethod · 0.95
NewFunction · 0.85
NewContextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…