github.com/qioalice/ekago/v3@v3.3.2-0.20221202205325-5c262d586ee4/ekastr/itoa_test.go (about) 1 // Copyright © 2020. All rights reserved. 2 // Author: Ilya Yuryevich. 3 // Contacts: iyuryevich@pm.me, https://github.com/qioalice 4 // License: https://opensource.org/licenses/MIT 5 6 package ekastr_test 7 8 import ( 9 "strconv" 10 "testing" 11 12 "github.com/qioalice/ekago/v3/ekastr" 13 ) 14 15 func BenchmarkPItoa64(b *testing.B) { 16 b.ReportAllocs() 17 18 for i := 0; i < b.N; i++ { 19 _ = ekastr.PItoa64(int64(i)) 20 } 21 } 22 23 func BenchmarkBItoa64(b *testing.B) { 24 b.ReportAllocs() 25 26 buf := make([]byte, 20) 27 28 for i := 0; i < b.N; i++ { 29 _ = ekastr.BItoa64(buf, int64(i)) 30 } 31 } 32 33 func BenchmarkStdItoa(b *testing.B) { 34 b.ReportAllocs() 35 36 for i := 0; i < b.N; i++ { 37 _ = strconv.Itoa(i) 38 } 39 }