archive/tar: reuse temporary buffer in writeHeader
A temporary 512 bytes buffer is allocated for every call to
writeHeader. This buffer could be reused the lower the number
of memory allocations.
benchmark old ns/op new ns/op delta
BenchmarkWriteFiles100k
634622051 583810847 -8.01%
benchmark old allocs new allocs delta
BenchmarkWriteFiles100k
2701920 2602621 -3.68%
benchmark old bytes new bytes delta
BenchmarkWriteFiles100k
115383884 64349922 -44.23%
This change is very important if your code has to write a lot of
tarballs with a lot of files.
LGTM=dsymonds
R=golang-codereviews, dave, dsymonds
CC=golang-codereviews
https://golang.org/cl/
107440043