MCPcopy
hub / github.com/shopspring/decimal / BenchmarkNewFromStringFloat

Function BenchmarkNewFromStringFloat

decimal_bench_test.go:46–58  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

44}
45
46func BenchmarkNewFromStringFloat(b *testing.B) {
47 rng := rand.New(rand.NewSource(0xdead1337))
48 in := make([]float64, b.N)
49 for i := range in {
50 in[i] = rng.NormFloat64() * 10e20
51 }
52 b.ReportAllocs()
53 b.StartTimer()
54 for i := 0; i < b.N; i++ {
55 in := strconv.FormatFloat(in[i], 'f', -1, 64)
56 _, _ = NewFromString(in)
57 }
58}
59
60func Benchmark_FloorFast(b *testing.B) {
61 input := New(200, 2)

Callers

nothing calls this directly

Calls 1

NewFromStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…