Added a benchmark for writeHexInt

This commit is contained in:
Aliaksandr Valialkin
2015-11-28 23:07:25 +02:00
parent 974a1c99ce
commit 5d4db43538
+19
View File
@@ -1,9 +1,28 @@
package fasthttp
import (
"bufio"
"bytes"
"testing"
)
func BenchmarkWriteHexInt(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
var w bytes.Buffer
bw := bufio.NewWriter(&w)
i := 0
for pb.Next() {
writeHexInt(bw, i)
i++
if i > 0x7fffffff {
i = 0
}
w.Reset()
bw.Reset(&w)
}
})
}
func BenchmarkAppendUint(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
var buf []byte