| // Copyright 2011 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // This benchmark tests gzip and gunzip performance. |
| jsongunz = bytes.Repeat(jsonbytes, 10) |
| c := gz.NewWriter(ioutil.Discard) |
| if _, err := c.Write(jsongunz); err != nil { |
| if err := c.Close(); err != nil { |
| r, err := gz.NewReader(bytes.NewBuffer(jsongz)) |
| if _, err := io.Copy(ioutil.Discard, r); err != nil { |
| func BenchmarkGzip(b *testing.B) { |
| b.SetBytes(int64(len(jsongunz))) |
| for i := 0; i < b.N; i++ { |
| func BenchmarkGunzip(b *testing.B) { |
| b.SetBytes(int64(len(jsongunz))) |
| for i := 0; i < b.N; i++ { |