Which compression type should i choose in SharpZipLib?

本秂侑毒 提交于 2019-12-07 05:06:19

问题


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?

    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.


    回答1:


    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.



    来源:https://stackoverflow.com/questions/10263829/which-compression-type-should-i-choose-in-sharpziplib

  • 易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!