golang / snappy

The Snappy compression format in the Go programming language.
BSD 3-Clause "New" or "Revised" License
1.52k stars 164 forks source link

Question: Encode <> Decode size #33

Closed tonobo closed 8 years ago

tonobo commented 8 years ago

Hi, why is the encoded (compressed) string larger than the original? https://play.golang.org/p/J7iL2AwQ37

cespare commented 8 years ago

Snappy (and most compression formats) do not effectively compress very short strings, because they exploit repeating patterns in the input.

tonobo commented 8 years ago

Ahh, ok. But iam using it right?

cespare commented 8 years ago

Yes. You can also check decode the compressed data to make sure it matches the input. https://play.golang.org/p/CY7qYrMW1I