Benchmark_Compress_Levels_Parallel() — fiber Function Reference
Architecture documentation for the Benchmark_Compress_Levels_Parallel() function in compress_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 4c34bbfb_f369_df3a_fc09_b5afa1bc5541["Benchmark_Compress_Levels_Parallel()"] d6d930a5_a4c6_37a5_5df5_4b38486d6fe6["compress_test.go"] 4c34bbfb_f369_df3a_fc09_b5afa1bc5541 -->|defined in| d6d930a5_a4c6_37a5_5df5_4b38486d6fe6 style 4c34bbfb_f369_df3a_fc09_b5afa1bc5541 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/compress/compress_test.go lines 808–860
func Benchmark_Compress_Levels_Parallel(b *testing.B) {
tests := []struct {
name string
acceptEncoding string
}{
{name: "Gzip", acceptEncoding: "gzip"},
{name: "Deflate", acceptEncoding: "deflate"},
{name: "Brotli", acceptEncoding: "br"},
{name: "Zstd", acceptEncoding: "zstd"},
}
levels := []struct {
name string
level Level
}{
{name: "LevelDisabled", level: LevelDisabled},
{name: "LevelDefault", level: LevelDefault},
{name: "LevelBestSpeed", level: LevelBestSpeed},
{name: "LevelBestCompression", level: LevelBestCompression},
}
for _, tt := range tests {
for _, lvl := range levels {
b.Run(tt.name+"_"+lvl.name, func(b *testing.B) {
app := fiber.New()
app.Use(New(Config{Level: lvl.level}))
app.Get("/", func(c fiber.Ctx) error {
c.Set(fiber.HeaderContentType, fiber.MIMETextPlainCharsetUTF8)
return c.Send(filedata)
})
h := app.Handler()
b.ReportAllocs()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
fctx := &fasthttp.RequestCtx{}
fctx.Request.Header.SetMethod(fiber.MethodGet)
fctx.Request.SetRequestURI("/")
if tt.acceptEncoding != "" {
fctx.Request.Header.Set("Accept-Encoding", tt.acceptEncoding)
}
for pb.Next() {
h(fctx)
}
})
})
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Benchmark_Compress_Levels_Parallel() do?
Benchmark_Compress_Levels_Parallel() is a function in the fiber codebase, defined in middleware/compress/compress_test.go.
Where is Benchmark_Compress_Levels_Parallel() defined?
Benchmark_Compress_Levels_Parallel() is defined in middleware/compress/compress_test.go at line 808.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free