mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
added a benchmark for ParseUint
This commit is contained in:
@@ -23,6 +23,21 @@ func BenchmarkWriteHexInt(b *testing.B) {
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkParseUint(b *testing.B) {
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
buf := []byte("1234567")
|
||||
for pb.Next() {
|
||||
n, err := ParseUint(buf)
|
||||
if err != nil {
|
||||
b.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
if n != 1234567 {
|
||||
b.Fatalf("unexpected result: %d. Expecting %s", n, buf)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkAppendUint(b *testing.B) {
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
var buf []byte
|
||||
|
||||
Reference in New Issue
Block a user