Skip to content

Commit

Permalink
benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Nov 23, 2020
1 parent f69b4f0 commit 058ba37
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions types/dec_err_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,27 @@ func Benchmark(b *testing.B) {
}
}
}

func BenchmarkQuo(b *testing.B) {
b.StopTimer()
f0, f1 := rand.Float64(), rand.Float64()
x, y := apd.New(0, 0), apd.New(0, 0)
_, err := x.SetFloat64(f0)
if err != nil {
panic(err)
}
_, err = y.SetFloat64(f1)
if err != nil {
panic(err)
}

z := apd.New(0, 0)

b.StartTimer()
for i := 0; i < b.N; i++ {
_, err = decimal128Context.Quo(z, x, y)
if err != nil {
panic(err)
}
}
}

0 comments on commit 058ba37

Please sign in to comment.