MCPcopy Index your code
hub / github.com/labstack/echo / BenchmarkServeHTTP_JSON

Function BenchmarkServeHTTP_JSON

perf_bench_test.go:71–82  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

69}
70
71func BenchmarkServeHTTP_JSON(b *testing.B) {
72 e := New()
73 type payload struct {
74 ID int `json:"id"`
75 Name string `json:"name"`
76 Tags []string
77 }
78 p := payload{ID: 1, Name: "Jon Snow", Tags: []string{"a", "b", "c"}}
79 e.GET("/", func(c *Context) error { return c.JSON(http.StatusOK, p) })
80 req := httptest.NewRequest(http.MethodGet, "/", nil)
81 benchServe(b, e, req)
82}
83
84// Exercises a per-request Set (as request_id/auth middleware do), measuring the store-map reuse.
85func BenchmarkServeHTTP_Store(b *testing.B) {

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
benchServeFunction · 0.85
JSONMethod · 0.80
GETMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…