diff options
Diffstat (limited to 'bytesconv_timing_test.go')
-rw-r--r-- | bytesconv_timing_test.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bytesconv_timing_test.go b/bytesconv_timing_test.go index cb315ae..ffce543 100644 --- a/bytesconv_timing_test.go +++ b/bytesconv_timing_test.go @@ -7,20 +7,19 @@ import ( ) func BenchmarkInt2HexByte(b *testing.B) { + buf := []int{1,0xf,2,0xd,3,0xe,4,0xa,5,0xb,6,0xc,7,0xf,0,0xf,6,0xd,9,8,4,0x5} b.RunParallel(func(pb *testing.PB) { - var i int + var n int for pb.Next() { - i = 16 - for i > 0 { - i-- - int2hexbyte(i) + for _, n = range buf { + int2hexbyte(n) } } }) } func BenchmarkHexByte2Int(b *testing.B) { - buf := []byte("0123456789abcdefABCDEF") + buf := []byte("0A1B2c3d4E5F6C7a8D9ab7cd03ef") b.RunParallel(func(pb *testing.PB) { var c byte for pb.Next() { |