Added trailing slash for static routes
This commit is contained in:
parent
0323126f2c
commit
a7d64037a7
8 changed files with 119 additions and 96 deletions
|
@ -4,14 +4,15 @@ import (
|
|||
"testing"
|
||||
|
||||
"git.akyoto.dev/go/router"
|
||||
"git.akyoto.dev/go/router/testdata"
|
||||
)
|
||||
|
||||
func BenchmarkBlog(b *testing.B) {
|
||||
routes := loadRoutes("testdata/blog.txt")
|
||||
routes := testdata.Routes("testdata/blog.txt")
|
||||
r := router.New[string]()
|
||||
|
||||
for _, route := range routes {
|
||||
r.Add(route.method, route.path, "")
|
||||
r.Add(route.Method, route.Path, "")
|
||||
}
|
||||
|
||||
b.Run("Len1-Param0", func(b *testing.B) {
|
||||
|
@ -28,11 +29,11 @@ func BenchmarkBlog(b *testing.B) {
|
|||
}
|
||||
|
||||
func BenchmarkGitHub(b *testing.B) {
|
||||
routes := loadRoutes("testdata/github.txt")
|
||||
routes := testdata.Routes("testdata/github.txt")
|
||||
r := router.New[string]()
|
||||
|
||||
for _, route := range routes {
|
||||
r.Add(route.method, route.path, "")
|
||||
r.Add(route.Method, route.Path, "")
|
||||
}
|
||||
|
||||
b.Run("Len7-Param0", func(b *testing.B) {
|
||||
|
@ -53,3 +54,6 @@ func BenchmarkGitHub(b *testing.B) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
// noop serves as an empty addParameter function.
|
||||
func noop(string, string) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue