pmmp / ext-libdeflate

PHP bindings for libdeflate, a zlib replacement with significantly better performance.
MIT License
11 stars 2 forks source link

Reusable memory for compression output #5

Open dktapps opened 1 year ago

dktapps commented 1 year ago

compressBound often overestimates the amount of memory needed, meaning that we need to later allocate a second memory block with a smaller size than the original. However, this is very costly for large payloads. We would be able to mitigate this using a reusable memory block for compressing data.

SOF3 commented 1 year ago

does this first compress into the reused (probably thread-local) buffer and then gets copied to a user string? might this double the memory usage in the end?

dktapps commented 1 year ago

Yes, currently temporarily.