title: When golang does allocation for string to byte conversion
body: <pre><code>var testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  //var testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
  func BenchmarkHashing900000000(b *testing.B){
      var bufByte = bytes.Buffer{}
      for i := 0; i &lt; b.N ; i++{
          bufByte.WriteString(testString)
          Sum32(bufByte.Bytes())
          bufByte.Reset()
      }
  }
  
  func BenchmarkHashingWithNew900000000(b *testing.B){
      for i := 0; i &lt; b.N ; i++{
          bytStr := []byte(testString)
          Sum32(bytStr)
      }
  }
  </code></pre>
  
  <p>test result:  </p>
  
  <pre><code>With  testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  BenchmarkHashing900000000-4         50000000            35.2 ns/op         0 B/op          0 allocs/op
  BenchmarkHashingWithNew900000000-4  50000000            30.9 ns/op         0 B/op          0 allocs/op
  
  With testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
  BenchmarkHashing900000000-4         30000000            46.6 ns/op         0 B/op          0 allocs/op
  BenchmarkHashingWithNew900000000-4  20000000            73.0 ns/op        64 B/op          1 allocs/op
  </code></pre>
  
  <p>Why there is allocation in case of BenchmarkHashingWithNew900000000 when string is long but no allocation when string is small.<br>
  Sum32 : <a href="https://gowalker.org/github.com/spaolacci/murmur3" rel="noreferrer">https://gowalker.org/github.com/spaolacci/murmur3</a><br>
  <strong>I am using go1.6</strong></p>