From ace5b0b50bc47c67e1a03393084e9b155c7f7e31 Mon Sep 17 00:00:00 2001 From: Igor Mikushkin Date: Tue, 4 Sep 2018 00:00:00 +0400 Subject: [PATCH] Addressing benchmarks issues --- decimal_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/decimal_test.go b/decimal_test.go index 64f0552..0c3c1d3 100644 --- a/decimal_test.go +++ b/decimal_test.go @@ -200,6 +200,7 @@ func TestNewFromFloat32Quick(t *testing.T) { } func BenchmarkNewFromFloatWithExponent(b *testing.B) { + b.StopTimer() rng := rand.New(rand.NewSource(0xdead1337)) in := make([]float64, b.N) for i := range in { @@ -208,12 +209,12 @@ func BenchmarkNewFromFloatWithExponent(b *testing.B) { b.ReportAllocs() b.StartTimer() for i := 0; i < b.N; i++ { - in := rng.NormFloat64() * 10e20 - _ = NewFromFloatWithExponent(in, math.MinInt32) + _ = NewFromFloatWithExponent(in[i], math.MinInt32) } } func BenchmarkNewFromFloat(b *testing.B) { + b.StopTimer() rng := rand.New(rand.NewSource(0xdead1337)) in := make([]float64, b.N) for i := range in { @@ -227,6 +228,7 @@ func BenchmarkNewFromFloat(b *testing.B) { } func BenchmarkNewFromStringFloat(b *testing.B) { + b.StopTimer() rng := rand.New(rand.NewSource(0xdead1337)) in := make([]float64, b.N) for i := range in {