go test -run=^$ -bench=Benchmark_Router_GitHub_API -benchmem -count=16
(b *testing.B)
| 1888 | |
| 1889 | // go test -run=^$ -bench=Benchmark_Router_GitHub_API -benchmem -count=16 |
| 1890 | func Benchmark_Router_GitHub_API(b *testing.B) { |
| 1891 | app := New() |
| 1892 | registerDummyRoutes(app) |
| 1893 | app.startupProcess() |
| 1894 | |
| 1895 | c := &fasthttp.RequestCtx{} |
| 1896 | var match bool |
| 1897 | var err error |
| 1898 | |
| 1899 | b.ResetTimer() |
| 1900 | for i := range routesFixture.TestRoutes { |
| 1901 | b.RunParallel(func(pb *testing.PB) { |
| 1902 | c.Request.Header.SetMethod(routesFixture.TestRoutes[i].Method) |
| 1903 | for pb.Next() { |
| 1904 | c.URI().SetPath(routesFixture.TestRoutes[i].Path) |
| 1905 | |
| 1906 | ctx := app.AcquireCtx(c).(*DefaultCtx) //nolint:errcheck,forcetypeassert // not needed |
| 1907 | |
| 1908 | match, err = app.next(ctx) |
| 1909 | app.ReleaseCtx(ctx) |
| 1910 | } |
| 1911 | }) |
| 1912 | |
| 1913 | require.NoError(b, err) |
| 1914 | require.True(b, match) |
| 1915 | } |
| 1916 | } |
| 1917 | |
| 1918 | type testRoute struct { |
| 1919 | Method string `json:"method"` |
nothing calls this directly
no test coverage detected