mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Add benchmarks for commonly used routines.
R=rsc, r, r1 https://golang.org/cl/160046
This commit is contained in:
parent
a9d0da75f1
commit
f586870ec2
7 changed files with 176 additions and 6 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue