MCPcopy
hub / github.com/gofiber/fiber / Benchmark_Route_Match_Star_Parallel

Function Benchmark_Route_Match_Star_Parallel

router_test.go:2293–2308  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

2291}
2292
2293func Benchmark_Route_Match_Star_Parallel(b *testing.B) {
2294 var match bool
2295 var params [maxParams]string
2296 parsed := parseRoute("/*", regexp.MustCompile)
2297 route := &Route{use: false, root: false, star: true, routeParser: parsed, Params: parsed.params, path: "/user/keys/bla", Path: "/user/keys/bla", Method: "DELETE"}
2298 route.Handlers = append(route.Handlers, func(_ Ctx) error {
2299 return nil
2300 })
2301 b.RunParallel(func(pb *testing.PB) {
2302 for pb.Next() {
2303 match = route.match("/user/keys/bla", "/user/keys/bla", &params)
2304 }
2305 })
2306 require.True(b, match)
2307 require.Equal(b, []string{"user/keys/bla"}, params[0:len(parsed.params)])
2308}
2309
2310func Benchmark_Route_Match_Root_Parallel(b *testing.B) {
2311 var match bool

Callers

nothing calls this directly

Calls 3

matchMethod · 0.95
parseRouteFunction · 0.85
NextMethod · 0.65

Tested by

no test coverage detected