From 192c5af2fa6db95e000c0b36c5dff90d3892cbb2 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 30 Nov 2015 20:05:49 +0200 Subject: [PATCH] Added a benchmark for int2hexbyte --- bytesconv_timing_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bytesconv_timing_test.go b/bytesconv_timing_test.go index 4b66a92..2097997 100644 --- a/bytesconv_timing_test.go +++ b/bytesconv_timing_test.go @@ -6,6 +6,19 @@ import ( "testing" ) +func BenchmarkInt2HexByte(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + var i int + for pb.Next() { + i = 16 + for i >= 0 { + int2hexbyte(i) + i-- + } + } + }) +} + func BenchmarkHexByte2Int(b *testing.B) { buf := []byte("0123456789abcdefABCDEF") b.RunParallel(func(pb *testing.PB) {