mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-23 04:40:49 +01:00
Addressing benchmarks issues
This commit is contained in:
parent
cd690d0c9e
commit
ace5b0b50b
1 changed files with 4 additions and 2 deletions
|
@ -200,6 +200,7 @@ func TestNewFromFloat32Quick(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkNewFromFloatWithExponent(b *testing.B) {
|
func BenchmarkNewFromFloatWithExponent(b *testing.B) {
|
||||||
|
b.StopTimer()
|
||||||
rng := rand.New(rand.NewSource(0xdead1337))
|
rng := rand.New(rand.NewSource(0xdead1337))
|
||||||
in := make([]float64, b.N)
|
in := make([]float64, b.N)
|
||||||
for i := range in {
|
for i := range in {
|
||||||
|
@ -208,12 +209,12 @@ func BenchmarkNewFromFloatWithExponent(b *testing.B) {
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
in := rng.NormFloat64() * 10e20
|
_ = NewFromFloatWithExponent(in[i], math.MinInt32)
|
||||||
_ = NewFromFloatWithExponent(in, math.MinInt32)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkNewFromFloat(b *testing.B) {
|
func BenchmarkNewFromFloat(b *testing.B) {
|
||||||
|
b.StopTimer()
|
||||||
rng := rand.New(rand.NewSource(0xdead1337))
|
rng := rand.New(rand.NewSource(0xdead1337))
|
||||||
in := make([]float64, b.N)
|
in := make([]float64, b.N)
|
||||||
for i := range in {
|
for i := range in {
|
||||||
|
@ -227,6 +228,7 @@ func BenchmarkNewFromFloat(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkNewFromStringFloat(b *testing.B) {
|
func BenchmarkNewFromStringFloat(b *testing.B) {
|
||||||
|
b.StopTimer()
|
||||||
rng := rand.New(rand.NewSource(0xdead1337))
|
rng := rand.New(rand.NewSource(0xdead1337))
|
||||||
in := make([]float64, b.N)
|
in := make([]float64, b.N)
|
||||||
for i := range in {
|
for i := range in {
|
||||||
|
|
Loading…
Reference in a new issue