Merge remote-tracking branch 'origin/app-routes' into app-routes

pull/651/head
wernerr 2020-07-20 18:26:09 +02:00
commit baf44ff05e
1 changed files with 23 additions and 0 deletions

View File

@ -346,6 +346,29 @@ func Benchmark_Router_Chain(b *testing.B) {
}
}
// go test -v ./... -run=^$ -bench=Benchmark_Router_Compress -benchmem -count=4
func Benchmark_Router_Compress(b *testing.B) {
app := New()
handler := func(c *Ctx) {
c.Next()
}
app.Get("/", handler)
app.Get("/", handler)
app.Get("/", handler)
app.Get("/", handler)
app.Get("/", handler)
app.Get("/", handler)
c := &fasthttp.RequestCtx{}
c.Request.Header.SetMethod("GET")
c.URI().SetPath("/")
for n := 0; n < b.N; n++ {
app.handler(c)
}
}
// go test -v ./... -run=^$ -bench=Benchmark_Router_Next -benchmem -count=4
func Benchmark_Router_Next(b *testing.B) {
app := New()