Home / Function/ Benchmark_GenericParseTypeBytes() — fiber Function Reference

Benchmark_GenericParseTypeBytes() — fiber Function Reference

Architecture documentation for the Benchmark_GenericParseTypeBytes() function in helpers_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  efe60bf5_1ceb_7901_0022_d36779ce7ff9["Benchmark_GenericParseTypeBytes()"]
  c82e3595_b1b8_f596_c097_f26fa40159d1["helpers_test.go"]
  efe60bf5_1ceb_7901_0022_d36779ce7ff9 -->|defined in| c82e3595_b1b8_f596_c097_f26fa40159d1
  style efe60bf5_1ceb_7901_0022_d36779ce7ff9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

helpers_test.go lines 1417–1462

func Benchmark_GenericParseTypeBytes(b *testing.B) {
	b.Skip("Skipped: too fast to compare reliably (results in sub-ns range are unstable)")
	cases := []struct {
		str   string
		err   error
		value []byte
	}{
		{
			value: []byte("alex"),
			str:   "alex",
		},
		{
			value: []byte("32.23"),
			str:   "32.23",
		},
		{
			value: []byte("john"),
			str:   "john",
		},
		{
			value: []byte(nil),
			str:   "",
			err:   errParsedEmptyBytes,
		},
	}

	for _, test := range cases {
		b.Run("benchmark_genericParseTypeBytes", func(b *testing.B) {
			var v []byte
			var err error
			b.ReportAllocs()
			b.ResetTimer()
			b.RunParallel(func(pb *testing.PB) {
				for pb.Next() {
					v, err = genericParseType[[]byte](test.str)
				}
			})
			if test.err == nil {
				require.NoError(b, err)
			} else {
				require.ErrorIs(b, err, test.err)
			}
			require.Equal(b, test.value, v)
		})
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Benchmark_GenericParseTypeBytes() do?
Benchmark_GenericParseTypeBytes() is a function in the fiber codebase, defined in helpers_test.go.
Where is Benchmark_GenericParseTypeBytes() defined?
Benchmark_GenericParseTypeBytes() is defined in helpers_test.go at line 1417.

Analyze Your Own Codebase

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

Try Supermodel Free