MCPcopy Create free account
hub / github.com/BryanMwangi/pine / BenchmarkRouter_Search_Param

Function BenchmarkRouter_Search_Param

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

Source from the content-addressed store, hash-verified

337}
338
339func BenchmarkRouter_Search_Param(b *testing.B) {
340 r := newTestRouter()
341 for i := 0; i < 50; i++ {
342 insertRoute(r, "GET", fmt.Sprintf("/user/:id/section/%d", i))
343 }
344 b.ResetTimer()
345 b.ReportAllocs()
346 for i := 0; i < b.N; i++ {
347 r.Search("GET", "/user/42/section/25")
348 }
349}
350
351func BenchmarkServeHTTP_StaticRoute(b *testing.B) {
352 server := New()

Callers

nothing calls this directly

Calls 3

newTestRouterFunction · 0.85
insertRouteFunction · 0.85
SearchMethod · 0.80

Tested by

no test coverage detected