cmd/pack: buffer writes in TestLargeDefs
cmd/pack: buffer writes in TestLargeDefs

TestLargeDefs was issuing over one million small writes to
create a 7MB file (large.go). This is quite slow on Plan 9
since our disk file systems aren't very fast and they're
usually accessed over the network.

Buffering the writes makes the test about six times faster.
Even on Linux, it's about 1.5 times faster.

Here are the results on a slow Plan 9 machine:

Before:
        % ./pack.test -test.v -test.run TestLargeDefs
        === RUN TestLargeDefs
        --- PASS: TestLargeDefs (125.11 seconds)
        PASS

After:
        % ./pack.test -test.v -test.run TestLargeDefs
        === RUN TestLargeDefs
        --- PASS: TestLargeDefs (20.835 seconds)
        PASS

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/95040044

Committer: Rob Pike <4dc7c9ec434ed06502767136789763ec11d2c4b7@golang.org>

apparentlymart/golang,apparentlymart/golang,apparentlymart/golang,apparentlymart/golang,apparentlymart/golang,apparentlymart/golang,apparentlymart/golang