diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2015-11-30 20:10:52 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2015-11-30 20:10:52 +0200 |
commit | 51d53b7accb1fa71959f6a983c9bf3f1aa5fe5d0 (patch) | |
tree | 01bfe5d727c2011a06f78ba9129632d098f1fd51 /bytesconv_timing_test.go | |
parent | Fixed a typo (diff) | |
download | fasthttp-51d53b7accb1fa71959f6a983c9bf3f1aa5fe5d0.tar.gz fasthttp-51d53b7accb1fa71959f6a983c9bf3f1aa5fe5d0.tar.bz2 fasthttp-51d53b7accb1fa71959f6a983c9bf3f1aa5fe5d0.zip |
Updated int <-> hex benchmarks
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() { |