Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update upperBound ratio when guessing the required decompression buff…
…er size We noticed that for one of our services we sometimes have a lot of allocations caused by the `ioutil.ReadAll` call in the `Decompress` method. After investigation those are coming from buffers whose decompressed size is greater than 10x the input size. This is quite wasteful because it means that we allocate twice for those buffers. Once in this branch: https://github.com/DataDog/zstd/blob/869dae002e5efb372a0b09cd7d99390ca2089cc1/zstd.go#L143 And another time here once we realise that the buffer we previously allocated wasn't big enough: https://github.com/DataDog/zstd/blob/869dae002e5efb372a0b09cd7d99390ca2089cc1/zstd.go#L154 This technically doesn't fully solve the problem but it should now happen less often. I can also make this upper bound configurable if this change sounds too scary
- Loading branch information