1. 15 Nov, 2017 8 commits
  2. 14 Nov, 2017 9 commits
  3. 13 Nov, 2017 14 commits
  4. 11 Nov, 2017 2 commits
  5. 10 Nov, 2017 1 commit
  6. 09 Nov, 2017 4 commits
  7. 08 Nov, 2017 2 commits
    • Use hex.EncodeToString to encode to hex · 143b56b5
      Using the EncodeToString function from the encoding/hex package
      is much faster than calling the fmt.Sprintf with %x
      
      Benchmark results below with the following code
      
      func BenchmarkHexPrint(b *testing.B) {
        data := []byte("hellothere")
        for n := 0; n < b.N; n++ {
          // _ = fmt.Sprintf("%x", data)
          _ = hex.EncodeToString(data)
        }
      }
      
      name        old time/op    new time/op    delta
      HexPrint-4     188ns ± 1%      99ns ± 1%  -47.40%  (p=0.008 n=5+5)
      
      name        old alloc/op   new alloc/op   delta
      HexPrint-4     64.0B ± 0%     64.0B ± 0%     ~     (all equal)
      
      name        old allocs/op  new allocs/op  delta
      HexPrint-4      2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      Agniva De Sarker committed