In the PHP manual there is a comment on gzdeflate saying:
gzcompress produces longer data because it embeds information about the encoding onto the string. If you are compressing data that will only ever be handled on one machine, then you don't need to worry about which of these functions you use. However, if you are passing data compressed with these functions to a different machine you should use gzcompress.
and then
running 50000 repetitions on various content, i found that gzdeflate() and gzcompress() both performed equally fast regardless content and compression level, but gzinflate() was always about twice as fast as gzuncompress().
For my purpose I am archiving data on a machine for future use. The data is read often, but written only once. In theory it will one day be moved onto another machine, if I change servers at some point, but that is a few years down the road.
Is it safe for me to use gzdeflate and gzinflate as opposed to gzcompress and gzuncompress?
My thinking is as follows: gzinflate is faster and this will help the server a lot since there will be lots of read requests. If at some point in the future I can't read the file then I should be able to figure out how to decompress the file and recompress it, right? It is not that the gzinflate will just magically not work one day, like the first comment appears to be saying. Even missing a 6 byte header I'm sure that it'll be expandable somehow.
Thoughts?
UPDATE -- Benchmark
10,000 iterations each:
gzdeflate took 19.158888816833 seconds and size 18521
gzinflate took 1.4803981781006 seconds
gzcompress took 19.376484870911 seconds and size 18527
gzuncompress took 1.6339199542999 seconds
gzencode took 20.015944004059 seconds and size 18539
gzdecodetook 1.8822891712189 seconds