2024-03-13 21:33:41 +00:00
|
|
|
package main_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/matryer/way"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkWay(b *testing.B) {
|
2024-03-15 11:50:42 +00:00
|
|
|
bench(
|
|
|
|
b,
|
|
|
|
func() *way.Router {
|
|
|
|
return way.NewRouter()
|
|
|
|
},
|
|
|
|
func(r *way.Router, method string, path string) {
|
|
|
|
r.HandleFunc(method, path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2024-03-13 21:33:41 +00:00
|
|
|
w.Write(payload)
|
2024-03-15 11:50:42 +00:00
|
|
|
}))
|
|
|
|
},
|
|
|
|
)
|
2024-03-13 21:33:41 +00:00
|
|
|
}
|