Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which compression type should i choose in SharpZipLib?

I have a File Transfer Application that sends files and folders. (Server - client)
I am trying to send data over TCP (sockets), I've made some rules for the way of transferring the data, so if it's sending a large folder that has many files, it should compress them into a single zip file first then when that zip file sent, the receiver has to decompress it. so I have decided to use SharpZibLib and I have got a question about it.

  • Which type of compressing should i choose for my application?
    I read about the differences between ZIP and GZIP, and found that GZIP has better compression to reduce the size, and as I don't need to extract a special file from the GZIP file later, there's no need to use ZIP instead of GZIP!
    but in that library there are many types that I still don't know, so should I use GZIP or another type would be better for my application?

    enter image description here

    P.S: Priority for the time first, the point of using SharpZipLib is to put the (too many files) in a single file so it will be sent much faster than sending the (too many files) one by one.
    more details here.

  • like image 868
    Murhaf Sousli Avatar asked Nov 13 '22 06:11

    Murhaf Sousli


    1 Answers

    For speed, you should use gzip / zip. I presume that the library allows you to select the compression level. You should experiment with low levels, e.g. 1 to 4, to see what speed and degree of compression works best with your application.

    gzip / zip will outperform LZW in speed at the same compression effectiveness. I find that compression level 3 is faster than LZW and compresses much better.

    bzip2 will compress better than gzip / zip, but will take much longer.

    The other choices are not compressors.

    like image 190
    Mark Adler Avatar answered Nov 16 '22 03:11

    Mark Adler