diff options
| author | Trevor Strohman <trevor.strohman@gmail.com> | 2009-11-24 00:21:50 -0800 |
|---|---|---|
| committer | Trevor Strohman <trevor.strohman@gmail.com> | 2009-11-24 00:21:50 -0800 |
| commit | bf6a88e78a2275069fb4eacbbf69a65c344ad104 (patch) | |
| tree | cbd775b90e93026dabb52bf3a9d6e3eff1c3386a /src/pkg/strconv/atof_test.go | |
| parent | 3cb0c26b5715da56eb9c6b526038962d57fae6f9 (diff) | |
| download | golang-bf6a88e78a2275069fb4eacbbf69a65c344ad104.tar.gz | |
Add benchmarks for commonly used routines.
R=rsc, r, r1
http://codereview.appspot.com/160046
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/strconv/atof_test.go')
| -rw-r--r-- | src/pkg/strconv/atof_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pkg/strconv/atof_test.go b/src/pkg/strconv/atof_test.go index c9b374d35..a10381d07 100644 --- a/src/pkg/strconv/atof_test.go +++ b/src/pkg/strconv/atof_test.go @@ -138,3 +138,27 @@ func testAtof(t *testing.T, opt bool) { func TestAtof(t *testing.T) { testAtof(t, true) } func TestAtofSlow(t *testing.T) { testAtof(t, false) } + +func BenchmarkAtofDecimal(b *testing.B) { + for i := 0; i < b.N; i++ { + Atof("33909") + } +} + +func BenchmarkAtofFloat(b *testing.B) { + for i := 0; i < b.N; i++ { + Atof("339.7784") + } +} + +func BenchmarkAtofFloatExp(b *testing.B) { + for i := 0; i < b.N; i++ { + Atof("-5.09e75") + } +} + +func BenchmarkAtofBig(b *testing.B) { + for i := 0; i < b.N; i++ { + Atof("123456789123456789123456789") + } +} |
