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

Function BenchmarkServeHTTP_Middleware

perf_bench_test.go:52–62  ·  view source on GitHub ↗

Exercises the global middleware chain (finding #1). Five pass-through middlewares.

(b *testing.B)

Source from the content-addressed store, hash-verified

50
51// Exercises the global middleware chain (finding #1). Five pass-through middlewares.
52func BenchmarkServeHTTP_Middleware(b *testing.B) {
53 e := New()
54 for i := 0; i < 5; i++ {
55 e.Use(func(next HandlerFunc) HandlerFunc {
56 return func(c *Context) error { return next(c) }
57 })
58 }
59 e.GET("/users/:id", func(c *Context) error { return c.NoContent(http.StatusOK) })
60 req := httptest.NewRequest(http.MethodGet, "/users/42", nil)
61 benchServe(b, e, req)
62}
63
64func BenchmarkServeHTTP_String(b *testing.B) {
65 e := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
benchServeFunction · 0.85
NoContentMethod · 0.80
UseMethod · 0.45
GETMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…