Added pat

This commit is contained in:
2024-03-13 23:30:18 +01:00
parent 2e9daf9a78
commit f9cc8530fb
4 changed files with 27 additions and 0 deletions

View File

@ -6,6 +6,7 @@ require (
git.akyoto.dev/go/router v0.1.3
git.akyoto.dev/go/server v0.0.0-20240313191801-c13dbc55d263
github.com/beego/beego/v2 v2.1.6
github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f
github.com/gin-gonic/gin v1.9.1
github.com/go-chi/chi/v5 v5.0.12
github.com/labstack/echo/v4 v4.11.4

View File

@ -8,6 +8,8 @@ github.com/beego/beego/v2 v2.1.6 h1:ny2WqvtpG1gAkEqJ9PQrOz6ZcQvVBJK+dECDOd/heIM=
github.com/beego/beego/v2 v2.1.6/go.mod h1:kFJvA21OjBwixXKx7BeH+Ug492Pp+h4cORHFTf1L8e0=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f h1:gOO/tNZMjjvTKZWpY7YnXC72ULNLErRtp94LountVE8=
github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=

22
web/pat_test.go Normal file
View File

@ -0,0 +1,22 @@
package main_test
import (
"net/http"
"testing"
"github.com/bmizerany/pat"
)
func BenchmarkPat(b *testing.B) {
bench(
b,
func() *pat.PatternServeMux {
return pat.New()
},
func(m *pat.PatternServeMux, method string, path string) {
m.Add(method, path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write(payload)
}))
},
)
}