Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: fix benchmark results #1982

Merged
merged 6 commits into from
Aug 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
v3: fix benchmark results
  • Loading branch information
efectn committed Jul 26, 2022
commit 257c7018b463d6cd481c59c1869b7f04f3e9db3a
20 changes: 10 additions & 10 deletions ctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_Ctx_Accepts(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_Accepts -benchmem -count=4
func Benchmark_Ctx_Accepts(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

c.Request().Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9")
var res string
Expand Down Expand Up @@ -141,7 +141,7 @@ func Test_Ctx_AcceptsCharsets(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_AcceptsCharsets -benchmem -count=4
func Benchmark_Ctx_AcceptsCharsets(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

c.Request().Header.Set("Accept-Charset", "utf-8, iso-8859-1;q=0.5")
var res string
Expand All @@ -167,7 +167,7 @@ func Test_Ctx_AcceptsEncodings(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_AcceptsEncodings -benchmem -count=4
func Benchmark_Ctx_AcceptsEncodings(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

c.Request().Header.Set(HeaderAcceptEncoding, "deflate, gzip;q=1.0, *;q=0.5")
var res string
Expand All @@ -192,7 +192,7 @@ func Test_Ctx_AcceptsLanguages(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_AcceptsLanguages -benchmem -count=4
func Benchmark_Ctx_AcceptsLanguages(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

c.Request().Header.Set(HeaderAcceptLanguage, "fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5")
var res string
Expand Down Expand Up @@ -253,7 +253,7 @@ func Test_Ctx_Append(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_Append -benchmem -count=4
func Benchmark_Ctx_Append(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

b.ReportAllocs()
b.ResetTimer()
Expand Down Expand Up @@ -286,7 +286,7 @@ func Test_Ctx_Attachment(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_Attachment -benchmem -count=4
func Benchmark_Ctx_Attachment(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

b.ReportAllocs()
b.ResetTimer()
Expand All @@ -312,7 +312,7 @@ func Test_Ctx_BaseURL(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_BaseURL -benchmem
func Benchmark_Ctx_BaseURL(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

c.Request().SetHost("google.com:1337")
c.Request().URI().SetPath("/haha/oke/lol")
Expand Down Expand Up @@ -722,7 +722,7 @@ func Test_Ctx_Cookie(t *testing.T) {
// go test -v -run=^$ -bench=Benchmark_Ctx_Cookie -benchmem -count=4
func Benchmark_Ctx_Cookie(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

b.ReportAllocs()
b.ResetTimer()
Expand Down Expand Up @@ -2539,7 +2539,7 @@ func Benchmark_Ctx_RedirectToRoute(b *testing.B) {
return c.JSON(c.Params("name"))
}).Name("user")

c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

b.ReportAllocs()
b.ResetTimer()
Expand Down Expand Up @@ -3018,7 +3018,7 @@ func Benchmark_Ctx_Type(b *testing.B) {
// go test -v -run=^$ -bench=Benchmark_Ctx_Type_Charset -benchmem -count=4
func Benchmark_Ctx_Type_Charset(b *testing.B) {
app := New()
c := app.NewCtx(&fasthttp.RequestCtx{})
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)

b.ReportAllocs()
b.ResetTimer()
Expand Down