Home / Function/ Benchmark_Middleware_Encrypt_Cookie_Parallel() — fiber Function Reference

Benchmark_Middleware_Encrypt_Cookie_Parallel() — fiber Function Reference

Architecture documentation for the Benchmark_Middleware_Encrypt_Cookie_Parallel() function in encryptcookie_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  cdafa97e_7aa2_ec5b_753d_81cb8c94238e["Benchmark_Middleware_Encrypt_Cookie_Parallel()"]
  ac3bbef3_a1d3_d68b_64fb_619088dde10d["encryptcookie_test.go"]
  cdafa97e_7aa2_ec5b_753d_81cb8c94238e -->|defined in| ac3bbef3_a1d3_d68b_64fb_619088dde10d
  style cdafa97e_7aa2_ec5b_753d_81cb8c94238e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/encryptcookie/encryptcookie_test.go lines 587–644

func Benchmark_Middleware_Encrypt_Cookie_Parallel(b *testing.B) {
	testKey := GenerateKey(32)
	app := fiber.New()

	app.Use(New(Config{
		Key: testKey,
	}))

	app.Get("/", func(c fiber.Ctx) error {
		return c.SendString("value=" + c.Cookies("test"))
	})
	app.Post("/", func(c fiber.Ctx) error {
		c.Cookie(&fiber.Cookie{
			Name:  "test",
			Value: "SomeThing",
		})
		return nil
	})

	h := app.Handler()

	b.Run("Empty Cookie Parallel", func(b *testing.B) {
		b.ReportAllocs()
		b.ResetTimer()
		b.RunParallel(func(pb *testing.PB) {
			for pb.Next() {
				ctx := &fasthttp.RequestCtx{}
				ctx.Request.Header.SetMethod(fiber.MethodGet)
				h(ctx)
			}
		})
	})

	b.Run("Invalid Cookie Parallel", func(b *testing.B) {
		b.ReportAllocs()
		b.ResetTimer()
		b.RunParallel(func(pb *testing.PB) {
			for pb.Next() {
				ctx := &fasthttp.RequestCtx{}
				ctx.Request.Header.SetMethod(fiber.MethodGet)
				ctx.Request.Header.SetCookie("test", "Invalid")
				h(ctx)
			}
		})
	})

	b.Run("Valid Cookie Parallel", func(b *testing.B) {
		b.ReportAllocs()
		b.ResetTimer()
		b.RunParallel(func(pb *testing.PB) {
			for pb.Next() {
				ctx := &fasthttp.RequestCtx{}
				ctx.Request.Header.SetMethod(fiber.MethodPost)
				h(ctx)
			}
		})
	})
}

Domain

Subdomains

Frequently Asked Questions

What does Benchmark_Middleware_Encrypt_Cookie_Parallel() do?
Benchmark_Middleware_Encrypt_Cookie_Parallel() is a function in the fiber codebase, defined in middleware/encryptcookie/encryptcookie_test.go.
Where is Benchmark_Middleware_Encrypt_Cookie_Parallel() defined?
Benchmark_Middleware_Encrypt_Cookie_Parallel() is defined in middleware/encryptcookie/encryptcookie_test.go at line 587.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free