added a benchmark for ParseUint

This commit is contained in:
Aliaksandr Valialkin
2015-11-29 13:38:35 +02:00
parent 90e07dd759
commit 741affeb8a
+15
View File
@@ -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