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

Function BenchmarkGzip

middleware/compress_test.go:378–398  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

376}
377
378func BenchmarkGzip(b *testing.B) {
379 e := echo.New()
380
381 req := httptest.NewRequest(http.MethodGet, "/", nil)
382 req.Header.Set(echo.HeaderAcceptEncoding, gzipScheme)
383
384 h := Gzip()(func(c *echo.Context) error {
385 c.Response().Write([]byte("test")) // For Content-Type sniffing
386 return nil
387 })
388
389 b.ReportAllocs()
390 b.ResetTimer()
391
392 for i := 0; i < b.N; i++ {
393 // Gzip
394 rec := httptest.NewRecorder()
395 c := e.NewContext(req, rec)
396 h(c)
397 }
398}

Callers

nothing calls this directly

Calls 5

ResponseMethod · 0.95
GzipFunction · 0.85
SetMethod · 0.80
NewContextMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…