My input data comes in small chunks and the output is saved to a file on disk. I'm looking for the fastest strategy for both input and output.
Does it make sense to create a bigger input buffer to accumulate more data before calling deflate(), or it's better to call deflate() for each small input chunk? What is the optimal buffer size for input, if any?
What is faster: using deflate() and writing the output from memory to a file with fwrite(), or using a combo function like gzfwrite which writes directly to file?
Is file mapping even faster than any of the 2. above?
Is there a way to parallelize the compression in multiple threads?