aboutsummaryrefslogtreecommitdiff
path: root/bytesconv_timing_test.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-28 22:58:52 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-28 22:58:52 +0200
commit1f97e8d9d63006ea45f72aad3ba0df43262a0782 (patch)
tree49cde1326a0cb827efbea3c34e0241df443cdd01 /bytesconv_timing_test.go
parentAdded a net/http advantage - it works on go older than 1.5 (diff)
downloadfasthttp-1f97e8d9d63006ea45f72aad3ba0df43262a0782.tar.gz
fasthttp-1f97e8d9d63006ea45f72aad3ba0df43262a0782.tar.bz2
fasthttp-1f97e8d9d63006ea45f72aad3ba0df43262a0782.zip
Added timing test for AppendUint
Diffstat (limited to 'bytesconv_timing_test.go')
-rw-r--r--bytesconv_timing_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/bytesconv_timing_test.go b/bytesconv_timing_test.go
index 387a3f9..10299e4 100644
--- a/bytesconv_timing_test.go
+++ b/bytesconv_timing_test.go
@@ -4,6 +4,20 @@ import (
"testing"
)
+func BenchmarkAppendUint(b *testing.B) {
+ b.RunParallel(func(pb *testing.PB) {
+ var buf []byte
+ i := 0
+ for pb.Next() {
+ buf = AppendUint(buf[:0], i)
+ i++
+ if i > 0x7fffffff {
+ i = 0
+ }
+ }
+ })
+}
+
func BenchmarkLowercaseBytesNoop(b *testing.B) {
src := []byte("foobarbaz_lowercased_all")
b.RunParallel(func(pb *testing.PB) {