]> Cypherpunks repositories - gostls13.git/commitdiff
strconv: add Ftoa benchmarks
authorRuss Cox <rsc@golang.org>
Tue, 15 Nov 2011 16:02:04 +0000 (11:02 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 15 Nov 2011 16:02:04 +0000 (11:02 -0500)
R=bradfitz
CC=golang-dev
https://golang.org/cl/5373096

src/pkg/strconv/ftoa_test.go

index 6d361a138efe81638a69c247ed51a1afad219899..8bac5da452671e3047bfe3210a500129e51e1f89 100644 (file)
@@ -148,3 +148,27 @@ func TestFtoa(t *testing.T) {
                }
        }
 }
+
+func BenchmarkFtoa64Decimal(b *testing.B) {
+       for i := 0; i < b.N; i++ {
+               Ftoa64(33909, 'g', -1)
+       }
+}
+
+func BenchmarkFtoa64Float(b *testing.B) {
+       for i := 0; i < b.N; i++ {
+               Ftoa64(339.7784, 'g', -1)
+       }
+}
+
+func BenchmarkFtoa64FloatExp(b *testing.B) {
+       for i := 0; i < b.N; i++ {
+               Ftoa64(-5.09e75, 'g', -1)
+       }
+}
+
+func BenchmarkFtoa64Big(b *testing.B) {
+       for i := 0; i < b.N; i++ {
+               Ftoa64(123456789123456789123456789, 'g', -1)
+       }
+}