Add benchmarks for commonly used routines.

R=rsc, r, r1
https://golang.org/cl/160046
This commit is contained in:
Trevor Strohman 2009-11-24 00:21:50 -08:00 committed by Russ Cox
parent a9d0da75f1
commit f586870ec2
7 changed files with 176 additions and 6 deletions

View file

@ -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")
}
}