diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2015-11-05 12:07:54 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2015-11-05 12:07:54 +0200 |
commit | 87105b99cbed413898d7a0859672c8add5baddd7 (patch) | |
tree | d0e52c25f9fae6ff54867c9ee587ff7f83dcc6de /cookie_timing_test.go | |
parent | Enforce MaxConnsPerIP limit to connections served via Server.ServeConn() (diff) | |
download | fasthttp-87105b99cbed413898d7a0859672c8add5baddd7.tar.gz fasthttp-87105b99cbed413898d7a0859672c8add5baddd7.tar.bz2 fasthttp-87105b99cbed413898d7a0859672c8add5baddd7.zip |
Added response cookies support
Diffstat (limited to 'cookie_timing_test.go')
-rw-r--r-- | cookie_timing_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cookie_timing_test.go b/cookie_timing_test.go new file mode 100644 index 0000000..6b9dc7c --- /dev/null +++ b/cookie_timing_test.go @@ -0,0 +1,35 @@ +package fasthttp + +import ( + "testing" +) + +func BenchmarkCookieParseMin(b *testing.B) { + var c Cookie + s := []byte("xxx=yyy") + for i := 0; i < b.N; i++ { + if err := c.Parse(s); err != nil { + b.Fatalf("unexpected error when parsing cookies: %s", err) + } + } +} + +func BenchmarkCookieParseNoExpires(b *testing.B) { + var c Cookie + s := []byte("xxx=yyy; domain=foobar.com; path=/a/b") + for i := 0; i < b.N; i++ { + if err := c.Parse(s); err != nil { + b.Fatalf("unexpected error when parsing cookies: %s", err) + } + } +} + +func BenchmarkCookieParseFull(b *testing.B) { + var c Cookie + s := []byte("xxx=yyy; expires=Tue, 10 Nov 2009 23:00:00 GMT; domain=foobar.com; path=/a/b") + for i := 0; i < b.N; i++ { + if err := c.Parse(s); err != nil { + b.Fatalf("unexpected error when parsing cookies: %s", err) + } + } +} |