Home / Function/ Benchmark_Session_Parallel() — fiber Function Reference

Benchmark_Session_Parallel() — fiber Function Reference

Architecture documentation for the Benchmark_Session_Parallel() function in session_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  d9c5df00_34f6_4d67_6c66_fc51d2796f9b["Benchmark_Session_Parallel()"]
  397e6e82_749b_4ef2_9365_02be671c59f7["session_test.go"]
  d9c5df00_34f6_4d67_6c66_fc51d2796f9b -->|defined in| 397e6e82_749b_4ef2_9365_02be671c59f7
  style d9c5df00_34f6_4d67_6c66_fc51d2796f9b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/session/session_test.go lines 1295–1338

func Benchmark_Session_Parallel(b *testing.B) {
	b.Run("default", func(b *testing.B) {
		app, store := fiber.New(), NewStore()
		b.ReportAllocs()
		b.ResetTimer()
		b.RunParallel(func(pb *testing.PB) {
			for pb.Next() {
				c := app.AcquireCtx(&fasthttp.RequestCtx{})
				c.Request().Header.SetCookie("session_id", "12356789")

				sess, _ := store.Get(c) //nolint:errcheck // We're inside a benchmark
				sess.Set("john", "doe")
				_ = sess.Save() //nolint:errcheck // We're inside a benchmark

				sess.Release()

				app.ReleaseCtx(c)
			}
		})
	})

	b.Run("storage", func(b *testing.B) {
		app := fiber.New()
		store := NewStore(Config{
			Storage: memory.New(),
		})
		b.ReportAllocs()
		b.ResetTimer()
		b.RunParallel(func(pb *testing.PB) {
			for pb.Next() {
				c := app.AcquireCtx(&fasthttp.RequestCtx{})
				c.Request().Header.SetCookie("session_id", "12356789")

				sess, _ := store.Get(c) //nolint:errcheck // We're inside a benchmark
				sess.Set("john", "doe")
				_ = sess.Save() //nolint:errcheck // We're inside a benchmark

				sess.Release()

				app.ReleaseCtx(c)
			}
		})
	})
}

Subdomains

Frequently Asked Questions

What does Benchmark_Session_Parallel() do?
Benchmark_Session_Parallel() is a function in the fiber codebase, defined in middleware/session/session_test.go.
Where is Benchmark_Session_Parallel() defined?
Benchmark_Session_Parallel() is defined in middleware/session/session_test.go at line 1295.

Analyze Your Own Codebase

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

Try Supermodel Free