MCPcopy Create free account
hub / github.com/cockroachdb/apd / BenchmarkDecimalSetFloat

Function BenchmarkDecimalSetFloat

bench_test.go:126–144  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

124}
125
126func BenchmarkDecimalSetFloat(b *testing.B) {
127 rng := rand.New(rand.NewSource(461210934723948))
128 corpus := func() []float64 {
129 res := make([]float64, 8192)
130 for i := range res {
131 res[i] = rng.ExpFloat64()
132 }
133 return res
134 }()
135 b.ResetTimer()
136 b.ReportAllocs()
137 for i := 0; i < b.N; i++ {
138 var d Decimal
139 _, err := d.SetFloat64(corpus[rng.Intn(len(corpus))])
140 if err != nil {
141 b.Fatal(err)
142 }
143 }
144}

Callers

nothing calls this directly

Calls 1

SetFloat64Method · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…