Update ctx_bench_test.go

pull/367/head
Fenny 2020-05-13 00:49:16 +02:00
parent 991344f032
commit a08dbd5c5b
1 changed files with 9 additions and 4 deletions

View File

@ -403,10 +403,13 @@ func Benchmark_Ctx_Send(b *testing.B) {
c := AcquireCtx(&fasthttp.RequestCtx{})
defer ReleaseCtx(c)
var r = []byte("Hello, World")
var s = "Hello, World!"
var i = 1337
for n := 0; n < b.N; n++ {
c.Send([]byte("Hello, World"), "Hello, World!", "Hello, World!")
c.Send("Hello, World", 50, 30, 20)
c.Send(1337)
c.Send(r, s, s)
c.Send(s, i, i, i)
c.Send(r)
}
assertEqual(b, "1337", string(c.Fasthttp.Response.Body()))
}
@ -415,8 +418,10 @@ func Benchmark_Ctx_SendBytes(b *testing.B) {
c := AcquireCtx(&fasthttp.RequestCtx{})
defer ReleaseCtx(c)
var send = []byte("Hello, World")
for n := 0; n < b.N; n++ {
c.SendBytes([]byte("Hello, World"))
c.SendBytes(send)
}
assertEqual(b, "Hello, World", string(c.Fasthttp.Response.Body()))
}