Home / Function/ Benchmark_Session() — fiber Function Reference

Benchmark_Session() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

middleware/session/session_test.go lines 1257–1292

func Benchmark_Session(b *testing.B) {
	b.Run("default", func(b *testing.B) {
		app, store := fiber.New(), NewStore()
		c := app.AcquireCtx(&fasthttp.RequestCtx{})
		defer app.ReleaseCtx(c)
		c.Request().Header.SetCookie("session_id", "12356789")

		b.ReportAllocs()
		for b.Loop() {
			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()
		}
	})

	b.Run("storage", func(b *testing.B) {
		app := fiber.New()
		store := NewStore(Config{
			Storage: memory.New(),
		})
		c := app.AcquireCtx(&fasthttp.RequestCtx{})
		defer app.ReleaseCtx(c)
		c.Request().Header.SetCookie("session_id", "12356789")

		b.ReportAllocs()
		for b.Loop() {
			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()
		}
	})
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free