Zstandard:修订间差异
通过翻译页面“Zstandard”创建 |
→top: 更新版本 |
||
(未显示13个用户的28个中间版本) | |||
第1行: | 第1行: | ||
{{TARequired}} |
|||
'''Zstandard'''(或'''Zstd''')is a [[无损数据压缩|lossless]] [[数据压缩|data compression]] 算法algorithm developed by [[Yann Collet]] at [[Facebook]]的开发的。该名称也参考了[[C语言|C]]语言中的参考实现。第1版的实现于 发布为[[自由软件|free software]] on {{Date|2016-08-31}}.<ref>Sergio De Simone, [https://www.infoq.com/news/2016/09/facebook-zstandard-compression Facebook Open-Sources New Compression Algorithm Outperforming Zlib] / InfoQ, Sep 02, 2016</ref><ref>{{Cite news|url=http://www.theregister.co.uk/2016/08/31/facebook_open_source_database/|title=Life imitates satire: Facebook touts zlib killer just like Silicon Valley's Pied Piper|date=2016-08-31|publisher=The Register|accessdate=2016-09-06}}</ref> |
|||
{{NoteTA |
|||
|G1=IT |
|||
|G2=FL |
|||
|1=zh-cn:压缩级别;zh-tw:壓縮等級 |
|||
|2=zh-cn:deb包;zh-tw:deb |
|||
|3=zh-cn:官方仓库;zh-tw:官方儲存庫 |
|||
|4=zh-cn:实现;zh-tw:實作 |
|||
|5=zh-cn:自适应;zh-tw:自動調整 |
|||
|6=zh-cn:包;zh-tw:套件 |
|||
|7=cn:包管理器;zh-tw:套件管理員 |
|||
}} |
|||
{{Infobox software |
|||
| name = Zstandard |
|||
| author = Yann Collet |
|||
| developer = Yann Collet、Przemysław Skibiński([https://github.com/facebook/zstd/graphs/contributors inikep]) |
|||
| operating system = [[跨平台]] |
|||
| genre = [[数据压缩]] |
|||
| programming language = [[C语言|C]]、[[C++]] |
|||
| license = 雙授權:[[BSD许可证]], GPLv2 |
|||
| title = |
|||
| logo = Zstandard logo.png |
|||
| logo_size = 110px |
|||
| released = {{Start date|2015|01|24}} |
|||
| discontinued = |
|||
| latest release version = 1.5.6 |
|||
| latest release date = {{Start date and age|2024|03|31|df=y}}<ref>{{cite web|url=https://github.com/facebook/zstd/releases/tag/v1.5.6|title=Zstandard v1.5.6 - Chrome Edition|via=[[GitHub]]|archive-date=2024-10-17|archive-url=https://web.archive.org/web/20210501102900/https://github.com/facebook/zstd/releases|dead-url=no}}</ref> |
|||
| latest preview version = |
|||
| platform = 可移植 |
|||
| size = |
|||
| website = {{URL|//facebook.github.io/zstd/}} |
|||
}} |
|||
'''Zstandard'''(或'''Zstd''')是由[[Facebook]]的{{le|Yann Collet}}开发的一个[[无损数据压缩]]算法。该名称也指其[[C语言|C语言]]的[[参考实现|-{zh-hans:参考实现;zh-hant:參考實作}-]]。第1版的实现于2016年8月31日发布为[[自由软件]]<ref>Sergio De Simone, [https://www.infoq.com/news/2016/09/facebook-zstandard-compression Facebook Open-Sources New Compression Algorithm Outperforming Zlib] {{Wayback|url=https://www.infoq.com/news/2016/09/facebook-zstandard-compression |date=20211007055903 }}{{en}} / InfoQ, Sep 02, 2016</ref><ref>{{cite web|title=Facebook开源新的压缩算法,性能超zlib|url=http://www.infoq.com/cn/news/2016/09/facebook-zstandard-compression|website=InfoQ|accessdate=2017-06-11|language=zh-cn|date=2016-09-06|archive-date=2018-11-02|archive-url=https://web.archive.org/web/20181102215456/http://www.infoq.com/cn/news/2016/09/facebook-zstandard-compression|dead-url=no}}</ref><ref>{{Cite news|url=http://www.theregister.co.uk/2016/08/31/facebook_open_source_database/|title=Life imitates satire: Facebook touts zlib killer just like Silicon Valley's Pied Piper|date=2016-08-31|publisher=The Register|accessdate=2016-09-06|archive-date=2018-11-23|archive-url=https://web.archive.org/web/20181123165125/https://www.theregister.co.uk/2016/08/31/facebook_open_source_database/|dead-url=no}}</ref> |
|||
== 特色 == |
== 特色 == |
||
设计Zstandard的目的是提供一个类似于[[DEFLATE]]算法的压缩比,但更快,特别是解压缩快的算法。它的压缩级别从负5级(最快)到22级(压缩速度最慢,但是压缩比最高)可以-{zh-cn:调节;zh-tw:調整}-。<ref>https://github.com/facebook/zstd/releases/tag/v1.3.4 {{Wayback|url=https://github.com/facebook/zstd/releases/tag/v1.3.4 |date=20210911024159 }} Faster compression levels</ref> |
|||
Zstandard在设计上与[[DEFLATE]] ([[ZIP格式|.ZIP]], [[gzip]])有着差不多的压缩比,但有更高的压缩与解压缩速度。 |
|||
zstd套件里面有压缩和解压缩的并行(多线程)实现。从1.3.2版本(2017年10月)开始,zstd 有选择地-{zh-hans:实现;zh-hant:進行}-非常长的搜索和重复数据消除({{code|--long}},128MiB窗口),类似于rzip或lrzip。<ref>{{cite web |title=Command Line Interface for Zstandard library |url=https://github.com/facebook/zstd/blob/dev/programs/README.md |website=GitHub |language=en}}</ref> |
|||
Zstandard使用字典算法([[LZ77与LZ78|LZ77]])结合 的[[Finite State Entropy|有限状态熵]]([[Asymmetric Numeral Systems|tANS]]) of [[熵編碼法|entropy coding]]。 |
|||
压缩速度在最快和最慢级别之间可以相差20倍或更多,而解压缩速度统统很快,在最快和最慢级别之间相差不到20%。<ref name=openzfs>{{cite web |
|||
|url=http://www.open-zfs.org/zhwiki/w/images/b/b3/03-OpenZFS_2017_-_ZStandard_in_ZFS.pdf |
|||
|title=ZStandard in ZFS |
|||
|date=2017 |
|||
|accessdate=2019-04-20 |
|||
|website=open-zfs.org |
|||
|format=PDF |
|||
|archive-date=2019-12-18 |
|||
|archive-url=https://web.archive.org/web/20191218102535/http://open-zfs.org/zhwiki/w/images/b/b3/03-OpenZFS_2017_-_ZStandard_in_ZFS.pdf |
|||
|dead-url=no |
|||
}}</ref> Zstandard命令行有一个“自适应”({{code|--adapt}})模式,根据I/O条件改变压缩级别,主要是写入输出的速度。 |
|||
''Zstd''在其最大压缩级别下的压缩比接近[[LZMA|lzma]]、lzham和ppmx,并且比[[LHA_(檔案格式)|lza]]或[[bzip2]]性能更好。<ref>{{cite web |
|||
|url=http://mattmahoney.net/dc/silesia.html |
|||
|title=Silesia Open Source Compression Benchmark |
|||
|author=Matt Mahoney |
|||
|accessdate=2019-05-10 |
|||
|archive-date=2022-01-21 |
|||
|archive-url=https://web.archive.org/web/20220121165038/http://mattmahoney.net/dc/silesia.html |
|||
|dead-url=no |
|||
}}</ref><ref>{{cite web |
|||
|url=http://mattmahoney.net/dc/text.html |
|||
|title=Large Text Compression Benchmark, .2157 zstd |
|||
|author=Matt Mahoney |
|||
|date=2016-08-29 |
|||
|accessdate=2016-09-01 |
|||
|archive-date=2022-03-31 |
|||
|archive-url=https://web.archive.org/web/20220331031650/http://mattmahoney.net/dc/text.html |
|||
|dead-url=no |
|||
}}</ref> Zstandard达到了-{zh-cn:当前;zh-tw:目前}-的[[帕累托最优|-{zh-cn:帕累托最优;zh-tw:柏拉圖最適性}-]],因为它解压缩的速度比任何其他-{zh-cn:当前;zh-tw:目前}-可用的算法都要快,并且有类似的或者更好的压缩比。<ref name="web-compression">{{citation |
|||
|title=TurboBench: Static/Dynamic web content compression benchmark |
|||
|url=https://sites.google.com/site/powturbo/home/web-compression |
|||
|publisher=PowTurbo |
|||
|accessdate=2020-06-13 |
|||
|archive-date=2022-03-17 |
|||
|archive-url=https://web.archive.org/web/20220317204149/https://sites.google.com/site/powturbo/home/web-compression |
|||
|dead-url=no |
|||
}}</ref><ref name="silesia-benchmark">{{citation |
|||
|author=Matt Mahoney |
|||
|title=Silesia Open Source Compression Benchmark |
|||
|url=http://mattmahoney.net/dc/silesia.html |
|||
|accessdate=2020-06-13 |
|||
|archive-date=2022-01-21 |
|||
|archive-url=https://web.archive.org/web/20220121165038/http://mattmahoney.net/dc/silesia.html |
|||
|dead-url=no |
|||
}}</ref> |
|||
字典对小文件的压缩比有很大的影响,所以Zstandard可以使用用户提供的压缩字典。它还提供了一种训练模式,能够从一组样本生成一个字典。<ref>{{cite web |
|||
|url=https://indico.fnal.gov/event/15154/contribution/5/material/slides/0.pdf |
|||
|title=Facebook developers report massive speedups and compression ratio improvements when using dictionaries |
|||
|access-date=2020-06-13 |
|||
|archive-date=2018-01-25 |
|||
|archive-url=https://web.archive.org/web/20180125015337/https://indico.fnal.gov/event/15154/contribution/5/material/slides/0.pdf |
|||
|dead-url=no |
|||
}}</ref><ref>{{cite web |
|||
|url=https://code.facebook.com/posts/1658392934479273/smaller-and-faster-data-compression-with-zstandard/ |
|||
|title=Smaller and faster data compression with Zstandard |
|||
|date=31 August 2016 |
|||
|publisher=Facebook |
|||
|access-date=2017-06-11 |
|||
|archive-date=2020-11-08 |
|||
|archive-url=https://web.archive.org/web/20201108105437/https://code.facebook.com/posts/1658392934479273/smaller-and-faster-data-compression-with-zstandard |
|||
|dead-url=no |
|||
}}</ref> 特别是,可以加载一个字典来处理文件之间具有冗余的大型文件集,但不一定在每个文件(例如[[日志文件]])内。 |
|||
==使用情况== |
|||
{{Infobox file format |
|||
| extension = .zst |
|||
| mime = application/zstd<ref>{{cite IETF|title=Zstandard Compression and the application/zstd Media Type|rfc=8478|publisher=Tools.ietf.org|accessdate=2019-06-13}}</ref> |
|||
| genre = [[数据压缩]] |
|||
}} |
|||
[[Linux内核]]自2017年11月以来就包含了Zstandard (4.14版本) ,作为[[btrfs]]和[[squashfs]]文件系统的压缩方法。<ref>{{cite web |
|||
|url=https://lwn.net/Articles/733846/ |
|||
|title=The rest of the 4.14 merge window [LWN.net] |
|||
|website=lwn.net |
|||
|access-date=2020-06-13 |
|||
|archive-date=2021-11-22 |
|||
|archive-url=https://web.archive.org/web/20211122141753/https://lwn.net/Articles/733846/ |
|||
|dead-url=no |
|||
}}</ref><ref>{{cite web |
|||
|url=https://kernelnewbies.org/Linux_4.14 |
|||
|title=Linux_4.14 - Linux Kernel Newbies |
|||
|publisher=Kernelnewbies.org |
|||
|date= |
|||
|accessdate=2018-08-16 |
|||
|archive-date=2018-01-10 |
|||
|archive-url=https://web.archive.org/web/20180110114105/https://kernelnewbies.org/Linux_4.14 |
|||
|dead-url=no |
|||
}}</ref><ref>{{cite web |
|||
|url=https://www.phoronix.com/scan.php?page=news_item&px=Linux-4.14-Zstd-Pull |
|||
|title=Zstd Compression For Btrfs & Squashfs Set For Linux 4.14, Already Used Within Facebook - Phoronix |
|||
|website=www.phoronix.com |
|||
|accessdate=2020-06-13 |
|||
|archive-date=2019-07-25 |
|||
|archive-url=https://web.archive.org/web/20190725122757/https://www.phoronix.com/scan.php?page=news_item&px=Linux-4.14-Zstd-Pull |
|||
|dead-url=no |
|||
}}</ref> |
|||
2017年,Allan Jude将Zstandard集成到FreeBSD内核中,<ref>https://github.com/freebsd/freebsd/commit/28ef16535cde21eeeaf75f6006b3a77952b3b51</ref> 用于概念验证[[OpenZFS]]压缩方法。<ref name=openzfs /> 随后,它受集成为{{地區用詞|cn=核心转储|tw=核心傾印|start=英語:Core dump}}(用户程序和内核崩溃)的压缩器选项。 |
|||
[[AWS Redshift]]和[[RocksDB]]数据库支持使用Zstandard进行字段压缩。<ref name=Redshift>{{cite web |
|||
|url=https://docs.aws.amazon.com/redshift/latest/dg/zstd-encoding.html |
|||
|title=Zstandard Encoding - Amazon Redshift |
|||
|date=20 April 2019 |
|||
|access-date=2020-06-13 |
|||
|archive-date=2021-08-14 |
|||
|archive-url=https://web.archive.org/web/20210814225631/https://docs.aws.amazon.com/redshift/latest/dg/zstd-encoding.html |
|||
|dead-url=no |
|||
}}<!-- root? hadoop? MyRocks ? SQL servers? --></ref> |
|||
2018年3月,[[Canonical]]在[[Ubuntu]] Linux发行版中测试了<ref>{{Cite web |url=https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Zstd-Deb-Packages |title=Canonical Working On Zstd-Compressed Debian Packages For Ubuntu |last=Larabel |first=Michael |date=12 March 2018 |website=phoronix.com |publisher=Phoronix Media |access-date=29 October 2019 |quote=The developers at Canonical are considering a feature freeze exception to get this newly-developed Zstd Apt/Dpkg support in Ubuntu 18.04 LTS. In doing so, they mention they would be looking at enabling Zstd compression for packages by default in Ubuntu 18.10. |archive-date=2021-08-16 |archive-url=https://web.archive.org/web/20210816101454/https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Zstd-Deb-Packages |dead-url=no }}</ref>默认使用zstd作为[[deb|deb包]]压缩方法。与deb包的[[XZ Utils|xz]]压缩相比,-{zh-cn:级别;zh-tw:等級}-19的zstd解压缩速度要快得多,但代价是套件文件大小增加了6%。Debian开发者[[Ian Jackson]]希望再等几年再官方采用zstd来-{zh-cn:打包;zh-tw:封裝}-。<ref>{{cite web |
|||
|title=New Ubuntu Installs Could Be Speed Up by 10% with the Zstd Compression Algorithm |
|||
|url=https://news.softpedia.com/news/new-ubuntu-installs-could-be-speed-up-by-10-with-the-zstd-compression-algorithm-520177.shtml |
|||
|website=Softpedia |
|||
|accessdate=13 August 2018 |
|||
|date=Mar 12, 2018 |
|||
|archive-date=2021-10-06 |
|||
|archive-url=https://web.archive.org/web/20211006045638/https://news.softpedia.com/news/new-ubuntu-installs-could-be-speed-up-by-10-with-the-zstd-compression-algorithm-520177.shtml |
|||
|dead-url=no |
|||
}}</ref><ref>{{cite web |
|||
|title=Canonical Working On Zstd-Compressed Debian Packages For Ubuntu |
|||
|url=https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Zstd-Deb-Packages |
|||
|website=phoronix |
|||
|accessdate=13 August 2018 |
|||
|language=en |
|||
|date=12 March 2018 |
|||
|archive-date=2021-08-16 |
|||
|archive-url=https://web.archive.org/web/20210816101454/https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Zstd-Deb-Packages |
|||
|dead-url=no |
|||
}}</ref><ref>[https://lists.debian.org/debian-devel/2018/04/msg00680.html RFC: Support for zstd in .deb packages?] {{Wayback|url=https://lists.debian.org/debian-devel/2018/04/msg00680.html|date=20210815002955}}, [[Ian Jackson]], 2018-04-27.</ref> |
|||
2018年,该算法发布为 RFC 8478,它还定义了相关的[[媒体类型]]“application/zstd”、[[文件扩展名]]“zst”和[[HTTP压缩|HTTP内容编码]]“zstd”。<ref name="RFC8478"> |
|||
{{citation |
|||
|last=Collet |
|||
|first=Yann |
|||
|last2=Kucherawy |
|||
|first2=Murray |
|||
|title=RFC 8478: Zstandard Compression and the application/zstd Media Type |
|||
|series=Internet Engineering Task Force Request for Comments |
|||
|year=2018 |
|||
|location=Menlo Park, CA|publisher=IETF Trust}} |
|||
</ref> |
|||
2019年10月,随着pacman 5.2包管理器的发布,[[Arch Linux]]增加了对zstd包压缩方法的支持,<ref>{{Cite web |url=https://www.phoronix.com/scan.php?page=news_item&px=Arch-Linux-Pacman-Zstd-Near |title=存档副本 |access-date=2020-06-13 |archive-date=2022-03-18 |archive-url=https://web.archive.org/web/20220318032712/https://www.phoronix.com/scan.php?page=news_item&px=Arch-Linux-Pacman-Zstd-Near |dead-url=no }}</ref> 2020年1月,官方仓库中的包从xz转换为zstd。Arch采用<code>zstd -c -T0 --ultra -20 -</code>,与xz相比,所有压缩包的大小增加了0.8%,解压速度提高了1300%;当使用多个线程时,解压内存增加了50 MiB,压缩内存会增加,但会随着使用的线程数而扩展。<ref>{{Cite web |url=https://www.archlinux.org/news/now-using-zstandard-instead-of-xz-for-package-compression/ |title=Now using Zstandard instead of xz for package compression |last=Broda |first=Robin |date=2020-01-04 |website=Arch Linux |access-date=2020-01-05 |archive-date=2022-03-18 |archive-url=https://web.archive.org/web/20220318032814/https://archlinux.org/news/now-using-zstandard-instead-of-xz-for-package-compression/ |dead-url=no }}</ref><ref>[https://lists.archlinux.org/pipermail/arch-dev-public/2019-March/029542.html [arch-dev-public] RFC: (devtools) Changing default compression method to zstd] {{Wayback|url=https://lists.archlinux.org/pipermail/arch-dev-public/2019-March/029542.html |date=20210817122817 }}, Robin Broda, 2019-03-25.</ref><ref>[https://github.com/facebook/zstd/issues/999 Clarify zstd compressor output compatibility guarantees across versions] {{Wayback|url=https://github.com/facebook/zstd/issues/999 |date=20220320222342 }}, Yann Collet, assuring important for the same binary result is zstd version and compression level, 2019-03-18.</ref><ref>[https://git.archlinux.org/devtools.git/commit/?id=bcda211dd86b3bf54a9bc40d2e19f1aad4bbfbb8 makepkg.conf: change default compression method to zstd] {{Wayback|url=https://git.archlinux.org/devtools.git/commit/?id=bcda211dd86b3bf54a9bc40d2e19f1aad4bbfbb8 |date=20210531022118 }}, Robin Broda, Levente Polyak, default compression with zstd -c -T0 --ultra -20 -, 2019-12-27.</ref> |
|||
在.NSZ / .XCZ文件格式中完整实现了该算法以及多种压缩等级,<ref>{{Cite web |url=https://gbatemp.net/threads/nszip-nsp-compressor-decompressor-to-reduce-storage.530313/ |title=RELEASE - nsZip - NSP compressor/decompressor to reduce storage |website=GBAtemp.net - The Independent Video Game Community |language=en-US |access-date=2019-11-03 |archive-date=2021-08-15 |archive-url=https://web.archive.org/web/20210815051318/https://gbatemp.net/threads/nszip-nsp-compressor-decompressor-to-reduce-storage.530313/ |dead-url=no }}</ref> 由[[任天堂Switch]]混合游戏机的[[homebrew (video games)|自制]]社区开发。<ref>{{Citation |last=Bosshard |first=Nico |title=nsZip is a tool to compress/decompress Nintendo Switch games using the here specified NSZ file format: nicoboss/nsZip |date=2019-10-31 |url=https://github.com/nicoboss/nsZip |access-date=2019-11-03 |archive-date=2022-03-27 |archive-url=https://web.archive.org/web/20220327151207/https://github.com/nicoboss/nsZip |dead-url=no }}</ref> |
|||
== 许可协议 == |
== 许可协议 == |
||
参考实现以[[BSD许可证 |
参考实现以[[BSD许可证]]授权,发布在[[GitHub]]上。自1.0版本以来,它有额外的专利权许可。<ref>[https://github.com/facebook/zstd/blob/v1.3.0/PATENTS zstd/PATENTS "Additional Grant of Patent Rights Version 2"] {{Wayback|url=https://github.com/facebook/zstd/blob/v1.3.0/PATENTS |date=20210515045048 }}, Facebook</ref> |
||
自1.3.1版,<ref>[https://github.com/facebook/zstd/releases/tag/v1.3.1 "Zstd v1.3.1 release"] {{Wayback|url=https://github.com/facebook/zstd/releases/tag/v1.3.1 |date=20200912235153 }}, GitHub "facebook/zstd"</ref>拿掉此专利权许可,授权改成BSD + GPLv2双授权。<ref>[https://github.com/facebook/zstd/pull/801 "New license"] {{Wayback|url=https://github.com/facebook/zstd/pull/801 |date=20200912201251 }}, GitHub "facebook/zstd"</ref> |
|||
== 参见 == |
== 参见 == |
||
* [[Brotli]] |
* [[Brotli]] |
||
* [[LZFSE]] - [[蘋果公司 |
* [[LZFSE]] - [[蘋果公司]]自[[iOS 9]]和[[OS X]] 10.11开始使用类似的算法,并也于2016年6月开源。 |
||
== 参考资料 == |
== 参考资料 == |
||
第19行: | 第199行: | ||
* {{Official website|//facebook.github.io/zstd/}} |
* {{Official website|//facebook.github.io/zstd/}} |
||
* {{GitHub|facebook/zstd}} |
* {{GitHub|facebook/zstd}} |
||
* "[https://code.facebook.com/posts/1658392934479273/smaller-and-faster-data-compression-with-zstandard/ Smaller and faster data compression with Zstandard]",Yann Collet和Chip Turner,2016年8月31日,Facebook公告 |
* "[https://code.facebook.com/posts/1658392934479273/smaller-and-faster-data-compression-with-zstandard/ Smaller and faster data compression with Zstandard] {{Wayback|url=https://code.facebook.com/posts/1658392934479273/smaller-and-faster-data-compression-with-zstandard/ |date=20201108105437 }}",Yann Collet和Chip Turner,2016年8月31日,Facebook公告 |
||
* [https://www.theguardian.com/info/developer-blog/2016/dec/01/discover-new-compression-iinovations-brotli-and-zstandard The Guardian is using ZStandard instead of zlib] |
* [https://www.theguardian.com/info/developer-blog/2016/dec/01/discover-new-compression-iinovations-brotli-and-zstandard The Guardian is using ZStandard instead of zlib] {{Wayback|url=https://www.theguardian.com/info/developer-blog/2016/dec/01/discover-new-compression-iinovations-brotli-and-zstandard |date=20220222082035 }} |
||
{{压缩方法}} |
|||
[[Category:2016年软件]] |
[[Category:2016年软件]] |
||
[[Category:C函式庫]] |
[[Category:C函式庫]] |
||
[[Category:電腦科學小作品]] |
|||
[[Category:数据压缩自由软件]] |
[[Category:数据压缩自由软件]] |
||
[[Category:无损压缩算法]] |
[[Category:无损压缩算法]] |
2024年10月16日 (三) 23:01的最新版本
原作者 | Yann Collet |
---|---|
開發者 | Yann Collet、Przemysław Skibiński(inikep) |
首次发布 | 2015年1月24日 |
当前版本 | 1.5.6(2024年3月31日[1]) |
源代码库 | |
编程语言 | C、C++ |
操作系统 | 跨平台 |
平台 | 可移植 |
类型 | 数据压缩 |
许可协议 | 雙授權:BSD许可证, GPLv2 |
网站 | facebook |
Zstandard(或Zstd)是由Facebook的Yann Collet开发的一个无损数据压缩算法。该名称也指其C语言的参考实现。第1版的实现于2016年8月31日发布为自由软件[2][3][4]
特色
[编辑]设计Zstandard的目的是提供一个类似于DEFLATE算法的压缩比,但更快,特别是解压缩快的算法。它的压缩级别从负5级(最快)到22级(压缩速度最慢,但是压缩比最高)可以调节。[5]
zstd套件里面有压缩和解压缩的并行(多线程)实现。从1.3.2版本(2017年10月)开始,zstd 有选择地实现非常长的搜索和重复数据消除(--long
,128MiB窗口),类似于rzip或lrzip。[6]
压缩速度在最快和最慢级别之间可以相差20倍或更多,而解压缩速度统统很快,在最快和最慢级别之间相差不到20%。[7] Zstandard命令行有一个“自适应”(--adapt
)模式,根据I/O条件改变压缩级别,主要是写入输出的速度。
Zstd在其最大压缩级别下的压缩比接近lzma、lzham和ppmx,并且比lza或bzip2性能更好。[8][9] Zstandard达到了当前的帕累托最优,因为它解压缩的速度比任何其他当前可用的算法都要快,并且有类似的或者更好的压缩比。[10][11]
字典对小文件的压缩比有很大的影响,所以Zstandard可以使用用户提供的压缩字典。它还提供了一种训练模式,能够从一组样本生成一个字典。[12][13] 特别是,可以加载一个字典来处理文件之间具有冗余的大型文件集,但不一定在每个文件(例如日志文件)内。
使用情况
[编辑]扩展名 |
.zst |
---|---|
互联网媒体类型 |
application/zstd[14] |
格式类型 | 数据压缩 |
Linux内核自2017年11月以来就包含了Zstandard (4.14版本) ,作为btrfs和squashfs文件系统的压缩方法。[15][16][17]
2017年,Allan Jude将Zstandard集成到FreeBSD内核中,[18] 用于概念验证OpenZFS压缩方法。[7] 随后,它受集成为核心转储(英語:Core dump,台湾作核心傾印)(用户程序和内核崩溃)的压缩器选项。
AWS Redshift和RocksDB数据库支持使用Zstandard进行字段压缩。[19]
2018年3月,Canonical在Ubuntu Linux发行版中测试了[20]默认使用zstd作为deb包压缩方法。与deb包的xz压缩相比,级别19的zstd解压缩速度要快得多,但代价是套件文件大小增加了6%。Debian开发者Ian Jackson希望再等几年再官方采用zstd来打包。[21][22][23]
2018年,该算法发布为 RFC 8478,它还定义了相关的媒体类型“application/zstd”、文件扩展名“zst”和HTTP内容编码“zstd”。[24]
2019年10月,随着pacman 5.2包管理器的发布,Arch Linux增加了对zstd包压缩方法的支持,[25] 2020年1月,官方仓库中的包从xz转换为zstd。Arch采用zstd -c -T0 --ultra -20 -
,与xz相比,所有压缩包的大小增加了0.8%,解压速度提高了1300%;当使用多个线程时,解压内存增加了50 MiB,压缩内存会增加,但会随着使用的线程数而扩展。[26][27][28][29]
在.NSZ / .XCZ文件格式中完整实现了该算法以及多种压缩等级,[30] 由任天堂Switch混合游戏机的自制社区开发。[31]
许可协议
[编辑]参考实现以BSD许可证授权,发布在GitHub上。自1.0版本以来,它有额外的专利权许可。[32]
自1.3.1版,[33]拿掉此专利权许可,授权改成BSD + GPLv2双授权。[34]
参见
[编辑]参考资料
[编辑]- ^ Zstandard v1.5.6 - Chrome Edition. (原始内容存档于2024-10-17) –通过GitHub.
- ^ Sergio De Simone, Facebook Open-Sources New Compression Algorithm Outperforming Zlib (页面存档备份,存于互联网档案馆)(英文) / InfoQ, Sep 02, 2016
- ^ Facebook开源新的压缩算法,性能超zlib. InfoQ. 2016-09-06 [2017-06-11]. (原始内容存档于2018-11-02) (中文(中国大陆)).
- ^ Life imitates satire: Facebook touts zlib killer just like Silicon Valley's Pied Piper. The Register. 2016-08-31 [2016-09-06]. (原始内容存档于2018-11-23).
- ^ https://github.com/facebook/zstd/releases/tag/v1.3.4 (页面存档备份,存于互联网档案馆) Faster compression levels
- ^ Command Line Interface for Zstandard library. GitHub (英语).
- ^ 7.0 7.1 ZStandard in ZFS (PDF). open-zfs.org. 2017 [2019-04-20]. (原始内容存档 (PDF)于2019-12-18).
- ^ Matt Mahoney. Silesia Open Source Compression Benchmark. [2019-05-10]. (原始内容存档于2022-01-21).
- ^ Matt Mahoney. Large Text Compression Benchmark, .2157 zstd. 2016-08-29 [2016-09-01]. (原始内容存档于2022-03-31).
- ^ TurboBench: Static/Dynamic web content compression benchmark, PowTurbo, [2020-06-13], (原始内容存档于2022-03-17)
- ^ Matt Mahoney, Silesia Open Source Compression Benchmark, [2020-06-13], (原始内容存档于2022-01-21)
- ^ Facebook developers report massive speedups and compression ratio improvements when using dictionaries (PDF). [2020-06-13]. (原始内容存档 (PDF)于2018-01-25).
- ^ Smaller and faster data compression with Zstandard. Facebook. 31 August 2016 [2017-06-11]. (原始内容存档于2020-11-08).
- ^ Zstandard Compression and the application/zstd Media Type. Tools.ietf.org [2019-06-13]. RFC 8478.
- ^ The rest of the 4.14 merge window [LWN.net]. lwn.net. [2020-06-13]. (原始内容存档于2021-11-22).
- ^ Linux_4.14 - Linux Kernel Newbies. Kernelnewbies.org. [2018-08-16]. (原始内容存档于2018-01-10).
- ^ Zstd Compression For Btrfs & Squashfs Set For Linux 4.14, Already Used Within Facebook - Phoronix. www.phoronix.com. [2020-06-13]. (原始内容存档于2019-07-25).
- ^ https://github.com/freebsd/freebsd/commit/28ef16535cde21eeeaf75f6006b3a77952b3b51
- ^ Zstandard Encoding - Amazon Redshift. 20 April 2019 [2020-06-13]. (原始内容存档于2021-08-14).
- ^ Larabel, Michael. Canonical Working On Zstd-Compressed Debian Packages For Ubuntu. phoronix.com. Phoronix Media. 12 March 2018 [29 October 2019]. (原始内容存档于2021-08-16).
The developers at Canonical are considering a feature freeze exception to get this newly-developed Zstd Apt/Dpkg support in Ubuntu 18.04 LTS. In doing so, they mention they would be looking at enabling Zstd compression for packages by default in Ubuntu 18.10.
- ^ New Ubuntu Installs Could Be Speed Up by 10% with the Zstd Compression Algorithm. Softpedia. Mar 12, 2018 [13 August 2018]. (原始内容存档于2021-10-06).
- ^ Canonical Working On Zstd-Compressed Debian Packages For Ubuntu. phoronix. 12 March 2018 [13 August 2018]. (原始内容存档于2021-08-16) (英语).
- ^ RFC: Support for zstd in .deb packages? (页面存档备份,存于互联网档案馆), Ian Jackson, 2018-04-27.
- ^ Collet, Yann; Kucherawy, Murray, RFC 8478: Zstandard Compression and the application/zstd Media Type, Internet Engineering Task Force Request for Comments, Menlo Park, CA: IETF Trust, 2018
- ^ 存档副本. [2020-06-13]. (原始内容存档于2022-03-18).
- ^ Broda, Robin. Now using Zstandard instead of xz for package compression. Arch Linux. 2020-01-04 [2020-01-05]. (原始内容存档于2022-03-18).
- ^ [arch-dev-public RFC: (devtools) Changing default compression method to zstd] (页面存档备份,存于互联网档案馆), Robin Broda, 2019-03-25.
- ^ Clarify zstd compressor output compatibility guarantees across versions (页面存档备份,存于互联网档案馆), Yann Collet, assuring important for the same binary result is zstd version and compression level, 2019-03-18.
- ^ makepkg.conf: change default compression method to zstd (页面存档备份,存于互联网档案馆), Robin Broda, Levente Polyak, default compression with zstd -c -T0 --ultra -20 -, 2019-12-27.
- ^ RELEASE - nsZip - NSP compressor/decompressor to reduce storage. GBAtemp.net - The Independent Video Game Community. [2019-11-03]. (原始内容存档于2021-08-15) (美国英语).
- ^ Bosshard, Nico, nsZip is a tool to compress/decompress Nintendo Switch games using the here specified NSZ file format: nicoboss/nsZip, 2019-10-31 [2019-11-03], (原始内容存档于2022-03-27)
- ^ zstd/PATENTS "Additional Grant of Patent Rights Version 2" (页面存档备份,存于互联网档案馆), Facebook
- ^ "Zstd v1.3.1 release" (页面存档备份,存于互联网档案馆), GitHub "facebook/zstd"
- ^ "New license" (页面存档备份,存于互联网档案馆), GitHub "facebook/zstd"
外部链接
[编辑]- 官方网站
- GitHub上的zstd頁面
- "Smaller and faster data compression with Zstandard (页面存档备份,存于互联网档案馆)",Yann Collet和Chip Turner,2016年8月31日,Facebook公告
- The Guardian is using ZStandard instead of zlib (页面存档备份,存于互联网档案馆)