go test -v ./... -run=^$ -bench=Benchmark_Route_Match_Root -benchmem -count=4
(b *testing.B)
| 1803 | |
| 1804 | // go test -v ./... -run=^$ -bench=Benchmark_Route_Match_Root -benchmem -count=4 |
| 1805 | func 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("/", "/", ¶ms) |
| 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 |
| 1834 | func Benchmark_Router_Handler_CaseSensitive(b *testing.B) { |
nothing calls this directly
no test coverage detected