mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Added a benchmark for writeHexInt
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user