Home / Function/ Benchmark_Ctx_Range() — fiber Function Reference

Benchmark_Ctx_Range() — fiber Function Reference

Architecture documentation for the Benchmark_Ctx_Range() function in ctx_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  cb2d2359_ea2c_82a5_84cf_a58e40552385["Benchmark_Ctx_Range()"]
  7b3d4933_5ae3_f84d_ff6d_0cb34e268026["ctx_test.go"]
  cb2d2359_ea2c_82a5_84cf_a58e40552385 -->|defined in| 7b3d4933_5ae3_f84d_ff6d_0cb34e268026
  style cb2d2359_ea2c_82a5_84cf_a58e40552385 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

ctx_test.go lines 4354–4386

func Benchmark_Ctx_Range(b *testing.B) {
	app := New()
	c := app.AcquireCtx(&fasthttp.RequestCtx{})
	defer app.ReleaseCtx(c)

	testCases := []struct {
		str   string
		start int64
		end   int64
	}{
		{str: "bytes=-700", start: 300, end: 999},
		{str: "bytes=500-", start: 500, end: 999},
		{str: "bytes=500-1000", start: 500, end: 999},
		{str: "bytes=0-700,800-1000", start: 0, end: 700},
	}

	for _, tc := range testCases {
		b.Run(tc.str, func(b *testing.B) {
			c.Request().Header.Set(HeaderRange, tc.str)
			var (
				result Range
				err    error
			)
			for b.Loop() {
				result, err = c.Range(1000)
			}
			require.NoError(b, err)
			require.Equal(b, "bytes", result.Type)
			require.Equal(b, tc.start, result.Ranges[0].Start)
			require.Equal(b, tc.end, result.Ranges[0].End)
		})
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Benchmark_Ctx_Range() do?
Benchmark_Ctx_Range() is a function in the fiber codebase, defined in ctx_test.go.
Where is Benchmark_Ctx_Range() defined?
Benchmark_Ctx_Range() is defined in ctx_test.go at line 4354.

Analyze Your Own Codebase

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

Try Supermodel Free