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

Function BenchmarkDecimal_NewFromString

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

Source from the content-addressed store, hash-verified

250}
251
252func BenchmarkDecimal_NewFromString(b *testing.B) {
253 count := 72
254 prices := make([]string, 0, count)
255 for i := 1; i <= count; i++ {
256 prices = append(prices, fmt.Sprintf("%d.%d", i*100, i))
257 }
258
259 b.ReportAllocs()
260 b.ResetTimer()
261 for i := 0; i < b.N; i++ {
262 for _, p := range prices {
263 d, err := NewFromString(p)
264 if err != nil {
265 b.Log(d)
266 b.Error(err)
267 }
268 }
269 }
270}
271
272func BenchmarkDecimal_NewFromString_large_number(b *testing.B) {
273 count := 72

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…