Zstandard

壓縮演算法

Zstandard(或Zstd)是由FacebookYann Collet英語Yann Collet開發的一個無失真資料壓縮演算法。該名稱也指其C語言參考實作。第1版的實作於2016年8月31日釋出為自由軟體[3][4][5]

Zstandard
原作者Yann Collet
開發者Yann Collet、Przemysław Skibiński(inikep
首次釋出2015年1月24日 (2015-01-24)
目前版本
  • 1.5.6 (2024年3月27日;穩定版本)[1]
編輯維基數據鏈結
原始碼庫 編輯維基數據鏈結
程式語言C
作業系統跨平台
平台可移植
類型資料壓縮
授權條款雙授權:BSD授權條款, GPLv2
網站facebook.github.io/zstd/

特色 編輯

設計Zstandard的目的是提供一個類似於DEFLATE演算法的壓縮比,但更快,特別是解壓縮快的演算法。它的壓縮等級從負5級(最快)到22級(壓縮速度最慢,但是壓縮比最高)可以調整。[6]

zstd套件裡面有壓縮和解壓縮的並列(多執行緒)實作。從1.3.2版本(2017年10月)開始,zstd 有選擇地進行非常長的搜尋和重複資料消除(--long,128MiB窗口),類似於rzip或lrzip。[7]

壓縮速度在最快和最慢級別之間可以相差20倍或更多,而解壓縮速度統統很快,在最快和最慢級別之間相差不到20%。[8] Zstandard命令列有一個「自動調整」(--adapt)模式,根據I/O條件改變壓縮等級,主要是寫入輸出的速度。

Zstd在其最大壓縮等級下的壓縮比接近lzma、lzham和ppmx,並且比lzabzip2效能更好。[9][10] Zstandard達到了目前的柏拉圖最適性,因為它解壓縮的速度比任何其他目前可用的演算法都要快,並且有類似的或者更好的壓縮比。[11][12]

字典對小檔案的壓縮比有很大的影響,所以Zstandard可以使用使用者提供的壓縮字典。它還提供了一種訓練模式,能夠從一組樣本生成一個字典。[13][14] 特別是,可以載入一個字典來處理檔案之間具有冗餘的大型檔案集,但不一定在每個檔案(例如紀錄檔檔案)內。

使用情況 編輯

Zstandard
副檔名
.zst
網路媒體型式
application/zstd[15]
格式類型資料壓縮

Linux核心自2017年11月以來就套件含了Zstandard (4.14版本) ,作為btrfssquashfs檔案系統的壓縮方法。[16][17][18]

2017年,Allan Jude將Zstandard整合到FreeBSD核心中,[19] 用於概念驗證OpenZFS壓縮方法。[8] 隨後,它受整合為核心傾印(英語:Core dump,中國大陸作核心轉儲)(使用者程式和核心崩潰)的壓縮器選項。

AWS RedshiftRocksDB資料庫支援使用Zstandard進行欄位壓縮。[20]

2018年3月,CanonicalUbuntu Linux發行版中測試了[21]預設使用zstd作為deb壓縮方法。與deb的xz壓縮相比,等級19的zstd解壓縮速度要快得多,但代價是套件檔案大小增加了6%。Debian開發者Ian Jackson希望再等幾年再官方採用zstd來封裝。[22][23][24]

2018年,該演算法釋出為 RFC 8478,它還定義了相關的媒體類型「application/zstd」、副檔名「zst」和HTTP內容編碼「zstd」。[25]

2019年10月,隨著pacman 5.2套件管理器的釋出,Arch Linux增加了對zstd套件壓縮方法的支援,[26] 2020年1月,官方儲存庫中的套件從xz轉換為zstd。Arch採用zstd -c -T0 --ultra -20 -,與xz相比,所有壓縮檔的大小增加了0.8%,解壓速度提高了1300%;當使用多個執行緒時,解壓記憶體增加了50 MiB,壓縮記憶體會增加,但會隨著使用的執行緒數而擴充。[27][28][29][30] 在.NSZ / .XCZ檔案格式中完整實作了該演算法以及多種壓縮等級,[31]任天堂Switch混合遊戲機的自製社群開發。[32]

授權條款 編輯

參考實作以BSD授權條款授權,釋出在GitHub上。自1.0版本以來,它有額外的專利權授權。[33]

自1.3.1版,[34]拿掉此專利權授權,授權改成BSD + GPLv2雙授權。[35]

參見 編輯

參考資料 編輯

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

外部連結 編輯