Zstandard

维基百科,自由的百科全书
跳转到导航 跳转到搜索
Zstandard
File:Zstandard logo.png
原作者Yann Collet
开发者Yann Collet、Przemysław Skibiński(inikep
首次发布2015年1月24日 (2015-01-24)
当前版本1.5.7(2025年2月20日,​15个月前​(2025-02-20[1]
源代码库
  • {{URL|example.com|可选的显示文本}}
Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
编程语言CC++
引擎
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    操作系统跨平台
    平台可移植
    类型数据压缩
    许可协议双许可:BSD许可证, GPLv2
    网站facebook.github.io/zstd/

    Zstandard(或Zstd)是由FacebookYann Collet英语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,并且比lzabzip2性能更好。[8][9] Zstandard达到了当前的帕累托最优,因为它解压缩的速度比任何其他当前可用的算法都要快,并且有类似的或者更好的压缩比。[10][11]

    字典对小文件的压缩比有很大的影响,所以Zstandard可以使用用户提供的压缩字典。它还提供了一种训练模式,能够从一组样本生成一个字典。[12][13] 特别是,可以加载一个字典来处理文件之间具有冗余的大型文件集,但不一定在每个文件(例如日志文件)内。

    使用情况[编辑]

    Zstandard
    扩展名
    .zst
    互联网媒体类型
    application/zstd[14]
    格式类型数据压缩

    Linux内核自2017年11月以来就包含了Zstandard (4.14版本) ,作为btrfsSquashFS文件系统的压缩方法。[15][16][17]

    2017年,Allan Jude将Zstandard集成到FreeBSD内核中,[18] 用于概念验证OpenZFS压缩方法。[7] 随后,它受集成为核心转储(英语:Core dump)(用户程序和内核崩溃)的压缩器选项。

    AWS RedshiftRocksDB数据库支持使用Zstandard进行字段压缩。[19]

    2018年3月,CanonicalUbuntu Linux发行版中测试了[20]默认使用zstd作为deb包压缩方法。与deb包的xz压缩相比,级别19的zstd解压缩速度要快得多,但代价是包文件大小增加了6%。Debian开发者Ian Jackson英语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混合游戏机的自制英语homebrew (video games)社区开发。[31]

    许可协议[编辑]

    参考实现以BSD许可证授权,发布在GitHub上。自1.0版本以来,它有额外的专利权许可。[32]

    自1.3.1版,[33]拿掉此专利权许可,授权改成BSD + GPLv2双授权。[34]

    参见[编辑]

    参考资料[编辑]

    1. ^ Zstandard v1.5.7. (原始内容存档于2024-10-17) –通过GitHub. 
    2. ^ Sergio De Simone, Facebook Open-Sources New Compression Algorithm Outperforming Zlib页面存档备份,存于互联网档案馆(英文) / InfoQ, Sep 02, 2016
    3. ^ Facebook开源新的压缩算法,性能超zlib. InfoQ. 2016-09-06 [2017-06-11]. (原始内容存档于2018-11-02) (中文(中国大陆)). 
    4. ^ 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). 
    5. ^ https://github.com/facebook/zstd/releases/tag/v1.3.4页面存档备份,存于互联网档案馆) Faster compression levels
    6. ^ Command Line Interface for Zstandard library. GitHub (English). 
    7. ^ 7.0 7.1 ZStandard in ZFS (PDF). open-zfs.org. 2017 [2019-04-20]. (原始内容存档 (PDF)于2019-12-18). 
    8. ^ Matt Mahoney. Silesia Open Source Compression Benchmark. [2019-05-10]. (原始内容存档于2022-01-21). 
    9. ^ Matt Mahoney. Large Text Compression Benchmark, .2157 zstd. 2016-08-29 [2016-09-01]. (原始内容存档于2022-03-31). 
    10. ^ TurboBench: Static/Dynamic web content compression benchmark, PowTurbo, [2020-06-13], (原始内容存档于2022-03-17) 
    11. ^ Matt Mahoney, Silesia Open Source Compression Benchmark, [2020-06-13], (原始内容存档于2022-01-21) 
    12. ^ Facebook developers report massive speedups and compression ratio improvements when using dictionaries (PDF). [2020-06-13]. (原始内容存档 (PDF)于2018-01-25). 
    13. ^ Smaller and faster data compression with Zstandard. Facebook. 31 August 2016 [2017-06-11]. (原始内容存档于2020-11-08). 
    14. ^ Zstandard Compression and the application/zstd Media Type. Tools.ietf.org [2019-06-13]. RFC 8478. 
    15. ^ The rest of the 4.14 merge window [LWN.net]. lwn.net. [2020-06-13]. (原始内容存档于2021-11-22). 
    16. ^ Linux_4.14 - Linux Kernel Newbies. Kernelnewbies.org. [2018-08-16]. (原始内容存档于2018-01-10). 
    17. ^ Zstd Compression For Btrfs & Squashfs Set For Linux 4.14, Already Used Within Facebook - Phoronix. www.phoronix.com. [2020-06-13]. (原始内容存档于2019-07-25). 
    18. ^ https://github.com/freebsd/freebsd/commit/28ef16535cde21eeeaf75f6006b3a77952b3b51
    19. ^ Zstandard Encoding - Amazon Redshift. 20 April 2019 [2020-06-13]. (原始内容存档于2021-08-14). 
    20. ^ 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. 
    21. ^ New Ubuntu Installs Could Be Speed Up by 10% with the Zstd Compression Algorithm. Softpedia. Mar 12, 2018 [13 August 2018]. (原始内容存档于2021-10-06). 
    22. ^ Canonical Working On Zstd-Compressed Debian Packages For Ubuntu. phoronix. 12 March 2018 [13 August 2018]. (原始内容存档于2021-08-16) (English). 
    23. ^ RFC: Support for zstd in .deb包 packages?页面存档备份,存于互联网档案馆), Ian Jackson, 2018-04-27.
    24. ^ 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 
    25. ^ 存档副本. [2020-06-13]. (原始内容存档于2022-03-18). 
    26. ^ Broda, Robin. Now using Zstandard instead of xz for package compression. Arch Linux. 2020-01-04 [2020-01-05]. (原始内容存档于2022-03-18). 
    27. ^ [arch-dev-public RFC: (devtools) Changing default compression method to zstd] (页面存档备份,存于互联网档案馆), Robin Broda, 2019-03-25.
    28. ^ 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.
    29. ^ makepkg.conf: change default compression method to zstd页面存档备份,存于互联网档案馆), Robin Broda, Levente Polyak, default compression with zstd -c -T0 --ultra -20 -, 2019-12-27.
    30. ^ RELEASE - nsZip - NSP compressor/decompressor to reduce storage. GBAtemp.net - The Independent Video Game Community. [2019-11-03]. (原始内容存档于2021-08-15) (en-US). 
    31. ^ 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) 
    32. ^ zstd/PATENTS "Additional Grant of Patent Rights Version 2"页面存档备份,存于互联网档案馆), Facebook
    33. ^ "Zstd v1.3.1 release"页面存档备份,存于互联网档案馆), GitHub "facebook/zstd"
    34. ^ "New license"页面存档备份,存于互联网档案馆), GitHub "facebook/zstd"

    外部链接[编辑]