go1.5の文字連結処理が速い

かなり長めの文字列を生成しなくてはいけなくて いろいろ調べてたのだけど

1.4とくらべて1.5では連結処理が速くなっていました.

普段 strings.Join を使ってしまう自分にはありがたい感じです.

コード

以下結果

go1.4.2

./run.sh

go version go1.4.2 linux/amd64
testing: warning: no tests to run
PASS
BenchmarkStringsJoin____     2000000           766 ns/op         240 B/op          3 allocs/op
BenchmarkAppendOperator_      200000          7919 ns/op        3808 B/op          8 allocs/op
BenchmarkAppendOperatorF     1000000          1472 ns/op         416 B/op          8 allocs/op
BenchmarkHardCoding_____     5000000           421 ns/op          80 B/op          1 allocs/op
BenchmarkByteArray______     1000000          1344 ns/op         320 B/op          5 allocs/op
BenchmarkCapByteArray___     3000000           359 ns/op          80 B/op          1 allocs/op
BenchmarkBytesBuffer____      500000          2715 ns/op         448 B/op         10 allocs/op
BenchmarkCapBytesBuffer_      500000          2520 ns/op         416 B/op         10 allocs/op
BenchmarkCapBytesBuffer2     1000000          1432 ns/op         304 B/op          3 allocs/op

go1.5beta3

./run.sh

go version devel +d3ffc97 Wed Jul 29 23:50:20 2015 +0000 linux/amd64
testing: warning: no tests to run
PASS
BenchmarkStringsJoin____-4   5000000           357 ns/op         240 B/op          3 allocs/op
BenchmarkAppendOperator_-4   1000000          1985 ns/op        3808 B/op          8 allocs/op
BenchmarkAppendOperatorF-4   2000000           837 ns/op         416 B/op          8 allocs/op
BenchmarkHardCoding_____-4   5000000           276 ns/op          80 B/op          1 allocs/op
BenchmarkByteArray______-4   3000000           518 ns/op         320 B/op          5 allocs/op
BenchmarkCapByteArray___-4  10000000           148 ns/op          80 B/op          1 allocs/op
BenchmarkBytesBuffer____-4   2000000           716 ns/op         336 B/op          3 allocs/op
BenchmarkCapBytesBuffer_-4   3000000           563 ns/op         304 B/op          3 allocs/op
BenchmarkCapBytesBuffer2-4   3000000           486 ns/op         304 B/op          3 allocs/op
参考