[gzep] Fix compression level.
This commit is contained in:
parent
49a78fd593
commit
4b9df00fc8
2 changed files with 10 additions and 3 deletions
|
@ -9,11 +9,11 @@ goarch: amd64
|
|||
pkg: gitlab.com/slon/shad-go/gzep
|
||||
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
|
||||
BenchmarkEncodeSimple
|
||||
BenchmarkEncodeSimple-8 8307 124841 ns/op 813872 B/op 17 allocs/op
|
||||
BenchmarkEncodeSimple-8 7047 176628 ns/op 813872 B/op 17 allocs/op
|
||||
BenchmarkEncode
|
||||
BenchmarkEncode-8 2094512 620.0 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkEncode-8 41706 32616 ns/op 19 B/op 0 allocs/op
|
||||
PASS
|
||||
ok gitlab.com/slon/shad-go/gzep 3.756s
|
||||
ok gitlab.com/slon/shad-go/gzep 3.625s
|
||||
```
|
||||
|
||||
### С чего начать?
|
||||
|
|
|
@ -67,6 +67,13 @@ func TestEncode_Stress(t *testing.T) {
|
|||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestEncode_Compression(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
err := gzep.Encode(bytes.Repeat([]byte{0x1f}, 1000), buf)
|
||||
require.NoError(t, err)
|
||||
require.Less(t, buf.Len(), 1000)
|
||||
}
|
||||
|
||||
func decode(r io.Reader) ([]byte, error) {
|
||||
rr, err := gzip.NewReader(r)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue