0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

Improve compression speed

Use Huffman compression in order to fasten the compression speed as described in https://golang.org/pkg/compress/flate/#NewWriter
This commit is contained in:
nicolashardy 2018-10-23 11:05:54 +02:00 committed by GitHub
parent 50a64d04da
commit 20497437fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ import (
// Compress returns a compressed byte slice. // Compress returns a compressed byte slice.
func Compress(src []byte) []byte { func Compress(src []byte) []byte {
compressedData := new(bytes.Buffer) compressedData := new(bytes.Buffer)
compress(src, compressedData, 9) compress(src, compressedData, -2)
return compressedData.Bytes() return compressedData.Bytes()
} }