go test -v ./... -run=^$ -bench=Benchmark_Router_Chain -benchmem -count=4
(b *testing.B)
| 1585 | |
| 1586 | // go test -v ./... -run=^$ -bench=Benchmark_Router_Chain -benchmem -count=4 |
| 1587 | func Benchmark_Router_Chain(b *testing.B) { |
| 1588 | app := New() |
| 1589 | handler := func(c Ctx) error { |
| 1590 | return c.Next() |
| 1591 | } |
| 1592 | app.Get("/", handler, handler, handler, handler, handler, handler) |
| 1593 | |
| 1594 | appHandler := app.Handler() |
| 1595 | |
| 1596 | c := &fasthttp.RequestCtx{} |
| 1597 | |
| 1598 | c.Request.Header.SetMethod(MethodGet) |
| 1599 | c.URI().SetPath("/") |
| 1600 | for b.Loop() { |
| 1601 | appHandler(c) |
| 1602 | } |
| 1603 | } |
| 1604 | |
| 1605 | // go test -v ./... -run=^$ -bench=Benchmark_Router_WithCompression -benchmem -count=4 |
| 1606 | func Benchmark_Router_WithCompression(b *testing.B) { |