博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Add some compression to your program
阅读量:4447 次
发布时间:2019-06-07

本文共 1571 字,大约阅读时间需要 5 分钟。

There're many computer magics. One of my favorite is data compression. When I first meet a compression tool, I found I loved it too much. I tried every settings to compress different files for fun. Nowadays, many open source compression libraries are available. So why not add some compression to your program?

 

There're many well-known compression libraries, like zlib (my favorite!), bzip2, lzo, lzma. I'll compare some of them here.

 

Functionality:

zlib and lzma provide the most complete functions, even read/write data within an archive. bzip2 provides file compression and memory compression, but has no archive functions. lzo provides only memory compression.

 

Compression:

lzma compresses best, followed by bzip2, and zlib, and lzo.

 

Memory Consume:

lzo uses merely no memory, zlib uses very little memory, bzip2 uses more, and lzma consumes a lot!

 

Speed:

lzo is the fastest due to its lesser compression. zlib is faster then bzip2. lzma is the slowest. However, lzma supports using multi-thread, which boosts its speed. (But I don't think it's a good idea for embedded devices like iPhone...)

 

Code overhead:

lzo < zlib < bzip2 < lzma

 

License:

lzo is GPL, that means if you use this code, you have to open source. You can use rest of three without open source.

 

To me, zlib is my favorite, because it's fast enough, its compression is good enough, the functions are easy to use, and its code overhead is really small. The zlib's sdk pack also contains some useful third-party code, very useful. We'll discuss them later.

 

转载于:https://www.cnblogs.com/wane/p/3370987.html

你可能感兴趣的文章
Qt Font
查看>>
UILabel设置富文本格式显示
查看>>
[洛谷P3379]【模板】最近公共祖先(LCA)
查看>>
java程序——随机数求和
查看>>
HTML5的浏览器支持方案
查看>>
在Asp.Net MVC中使用Repeater控件
查看>>
应用程序已被安全设置阻止
查看>>
找球号(一)
查看>>
开发小计(3)
查看>>
[Codevs] 1001 舒适的路线
查看>>
Deep Learning相关
查看>>
MySQL 树形结构 根据指定节点 获取其所有父节点序列
查看>>
hdu_5773_The All-purpose Zero(LIS)
查看>>
流程控制之while循环
查看>>
JSONObject和JSONArray区别及基本用法
查看>>
java多线程例子
查看>>
目标检测网络之 YOLOv3
查看>>
python 使用pyinstaller,pywin32打包.py成.exe应用程序
查看>>
AFNetworking封装思路简析
查看>>
C# 之 批量插入数据到 SQLServer 中
查看>>