diff --git a/README.md b/README.md index 15ac619..f1aafd0 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ BenchmarkAkyoto/Hello-12 29872866 38.33 ns/op BenchmarkAkyoto/GitHub-12 15900098 72.91 ns/op 0 B/op 0 allocs/op BenchmarkBeego/Hello-12 1000000 1089 ns/op 880 B/op 8 allocs/op BenchmarkBeego/GitHub-12 722995 1654 ns/op 929 B/op 9 allocs/op +BenchmarkBone/Hello-12 42497811 26.97 ns/op 0 B/op 0 allocs/op +BenchmarkBone/GitHub-12 91179 12734 ns/op 4705 B/op 67 allocs/op BenchmarkChi/Hello-12 4328472 275.4 ns/op 336 B/op 2 allocs/op BenchmarkChi/GitHub-12 3447220 331.1 ns/op 336 B/op 2 allocs/op BenchmarkEcho/Hello-12 19503808 51.41 ns/op 0 B/op 0 allocs/op diff --git a/web/bone_test.go b/web/bone_test.go new file mode 100644 index 0000000..ffb35aa --- /dev/null +++ b/web/bone_test.go @@ -0,0 +1,22 @@ +package main_test + +import ( + "net/http" + "testing" + + "github.com/go-zoo/bone" +) + +func BenchmarkBone(b *testing.B) { + bench( + b, + func() *bone.Mux { + return bone.New() + }, + func(mux *bone.Mux, method string, path string) { + mux.Register(method, path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Write(payload) + })) + }, + ) +} diff --git a/web/go.mod b/web/go.mod index ccfddc7..110600c 100644 --- a/web/go.mod +++ b/web/go.mod @@ -9,6 +9,7 @@ require ( 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/go-zoo/bone v1.3.0 github.com/labstack/echo/v4 v4.11.4 github.com/matryer/way v0.0.0-20180416093233-9632d0c407b0 ) diff --git a/web/go.sum b/web/go.sum index d3baf1c..a412cb2 100644 --- a/web/go.sum +++ b/web/go.sum @@ -40,6 +40,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-zoo/bone v1.3.0 h1:PY6sHq37FnQhj+4ZyqFIzJQHvrrGx0GEc3vTZZC/OsI= +github.com/go-zoo/bone v1.3.0/go.mod h1:HI3Lhb7G3UQcAwEhOJ2WyNcsFtQX1WYHa0Hl4OBbhW8= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=