7 "github.com/go-playground/locales/currency"
10 func BenchmarkFmtNumber(b *testing.B) {
13 f64 := float64(1234567.43)
14 precision := uint64(2)
18 b.Run("", func(b *testing.B) {
19 for i := 0; i < b.N; i++ {
20 trans.FmtNumber(f64, precision)
24 b.Run("Parallel", func(b *testing.B) {
26 b.RunParallel(func(pb *testing.PB) {
29 trans.FmtNumber(f64, precision)
35 func BenchmarkFmtPercent(b *testing.B) {
39 precision := uint64(2)
43 b.Run("", func(b *testing.B) {
44 for i := 0; i < b.N; i++ {
45 trans.FmtPercent(f64, precision)
49 b.Run("Parallel", func(b *testing.B) {
51 b.RunParallel(func(pb *testing.PB) {
54 trans.FmtPercent(f64, precision)
60 func BenchmarkFmtCurrency(b *testing.B) {
63 f64 := float64(1234567.43)
64 precision := uint64(2)
68 b.Run("", func(b *testing.B) {
69 for i := 0; i < b.N; i++ {
70 trans.FmtCurrency(f64, precision, currency.USD)
74 b.Run("Parallel", func(b *testing.B) {
76 b.RunParallel(func(pb *testing.PB) {
79 trans.FmtCurrency(f64, precision, currency.USD)
85 func BenchmarkFmtAccounting(b *testing.B) {
88 f64 := float64(1234567.43)
89 precision := uint64(2)
93 b.Run("", func(b *testing.B) {
94 for i := 0; i < b.N; i++ {
95 trans.FmtAccounting(f64, precision, currency.USD)
99 b.Run("Parallel", func(b *testing.B) {
101 b.RunParallel(func(pb *testing.PB) {
104 trans.FmtAccounting(f64, precision, currency.USD)
110 func BenchmarkFmtDate(b *testing.B) {
117 b.Run("FmtDateShort", func(b *testing.B) {
118 for i := 0; i < b.N; i++ {
119 trans.FmtDateShort(t)
123 b.Run("FmtDateShortParallel", func(b *testing.B) {
125 b.RunParallel(func(pb *testing.PB) {
128 trans.FmtDateShort(t)
133 b.Run("FmtDateMedium", func(b *testing.B) {
134 for i := 0; i < b.N; i++ {
135 trans.FmtDateMedium(t)
139 b.Run("FmtDateMediumParallel", func(b *testing.B) {
141 b.RunParallel(func(pb *testing.PB) {
144 trans.FmtDateMedium(t)
149 b.Run("FmtDateLong", func(b *testing.B) {
150 for i := 0; i < b.N; i++ {
155 b.Run("FmtDateLongParallel", func(b *testing.B) {
157 b.RunParallel(func(pb *testing.PB) {
165 b.Run("FmtDateFull", func(b *testing.B) {
166 for i := 0; i < b.N; i++ {
171 b.Run("FmtDateFullParallel", func(b *testing.B) {
173 b.RunParallel(func(pb *testing.PB) {
182 func BenchmarkFmtTime(b *testing.B) {
189 b.Run("FmtTimeShort", func(b *testing.B) {
190 for i := 0; i < b.N; i++ {
191 trans.FmtTimeShort(t)
195 b.Run("FmtTimeShortParallel", func(b *testing.B) {
197 b.RunParallel(func(pb *testing.PB) {
200 trans.FmtTimeShort(t)
205 b.Run("FmtTimeMedium", func(b *testing.B) {
206 for i := 0; i < b.N; i++ {
207 trans.FmtTimeMedium(t)
211 b.Run("FmtTimeMediumParallel", func(b *testing.B) {
213 b.RunParallel(func(pb *testing.PB) {
216 trans.FmtTimeMedium(t)
221 b.Run("FmtTimeLong", func(b *testing.B) {
222 for i := 0; i < b.N; i++ {
227 b.Run("FmtTimeLongParallel", func(b *testing.B) {
229 b.RunParallel(func(pb *testing.PB) {
237 b.Run("FmtTimeFull", func(b *testing.B) {
238 for i := 0; i < b.N; i++ {
243 b.Run("FmtTimeFullParallel", func(b *testing.B) {
245 b.RunParallel(func(pb *testing.PB) {