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

Function Benchmark_Route_Match_Root

router_test.go:1805–1831  ·  view source on GitHub ↗

go test -v ./... -run=^$ -bench=Benchmark_Route_Match_Root -benchmem -count=4

(b *testing.B)

Source from the content-addressed store, hash-verified

1803
1804// go test -v ./... -run=^$ -bench=Benchmark_Route_Match_Root -benchmem -count=4
1805func Benchmark_Route_Match_Root(b *testing.B) {
1806 var match bool
1807 var params [maxParams]string
1808
1809 parsed := parseRoute("/", regexp.MustCompile)
1810 route := &Route{
1811 use: false,
1812 root: true,
1813 star: false,
1814 path: "/",
1815 routeParser: parsed,
1816 Params: parsed.params,
1817
1818 Path: "/",
1819 Method: "DELETE",
1820 }
1821 route.Handlers = append(route.Handlers, func(_ Ctx) error {
1822 return nil
1823 })
1824
1825 for b.Loop() {
1826 match = route.match("/", "/", &params)
1827 }
1828
1829 require.True(b, match)
1830 require.Equal(b, []string{}, params[0:len(parsed.params)])
1831}
1832
1833// go test -v ./... -run=^$ -bench=Benchmark_Router_Handler_CaseSensitive -benchmem -count=4
1834func Benchmark_Router_Handler_CaseSensitive(b *testing.B) {

Callers

nothing calls this directly

Calls 2

matchMethod · 0.95
parseRouteFunction · 0.85

Tested by

no test coverage detected