Purebasic spoils us with 5 different built-in compression codecs (6 if you count the uncompressed bundling of TAR, or 7 if you count the deprecated x86-only JCALG1)
These are: ZIP, LZMA, BriefLZ, TAR.GZip, and TAR.BZip2 (ps. Fred it would be nice if BZIP2 and GZIP were available on their own, rather than having to use TAR bundling! TAR is ewww but BZIP2 is awesome!)
So here's a simple test program to help find out which of Purebasic's built-in packers is best suited to the data we want to compress/decompress.
The variables are PACK TIME, UNPACK TIME, PACK SIZE/RATIO, and PB EXE SIZE. Each packer of course has its own strengths and weaknesses!
Here's the results of a 91 megabyte SQL dump (UTF8 textfile). Tested with Purebasic x86 5.40 LTS in Windows XP. I havent had a chance to do x64 test.
I ran each test twice and only recorded the 2nd result to ensure 'even caching':
ZIP LZMA BriefLZ TAR TAR.GZ TAR.BZ2 "Winning" order (TAR excluded):
PACK TIME 3175ms 67647ms 1653ms 1141ms 3325ms 9464ms BriefLZ, ZIP, TAR.GZ, TAR.BZ2, LZMA
UNPACK TIME 1532ms 2254ms 2273ms 1252ms 1332ms 3145ms TAR.GZ, ZIP, LZMA, BriefLZ, TAR.BZ2
PACK SIZE 25218579 18887882 34247532 94030848 25218522 19782588
PACK RATIO 26.820% 20.087% 36.422% 100.002% 26.820% 21.039% LZMA, TAR.BZ2, TAR.GZ, ZIP, BriefLZ
PB.EXE SIZE 207,872 291,328 15,872 219,648 219,648 219,648 BriefLZ, ZIP, TAR.GZ/TAR.BZ2, LZMA
So, from this one test with this dataset, we can summarize:
ZIP: A great balance of compression and speed.
LZMA: Extremely slow compression, but thats the price you pay for the very best compression ratio.
BriefLZ: Extremely good performance in both packing & unpacking, and the resulting exe is still TINY unlike the others. 36% compression to ZIPs 26% means it's not great, but still pretty good.
TAR.GZ: On par with ZIP.
TAR.BZ2: Compression ratio so very close to LZMA yet compression speed is 7x faster. Decompression 1.4x slower than LZMA however.
Quite a nice menu to choose from, depending on ours projects individual needs
One of the nice surprises I found was that the BriefLZ codec only adds 10kb to the exe - thats with full compress + decompress support! And its speed of both is very good, especially compression but still respectable decompress speed. Its compression ratio is also quite respectable too, compressing my 91mb sample file to 36%. Compared to ZIPs 27% its not great but still pretty good, and overall I think it makes an excellent packer for executable resources!