merge ws/arch2-unix (cpio, ar/deb, rpm, z, iso, lz4; containers/Cpio, Iso9660; codecs UnixCompress, Xxh32, Lz4 from ws/roblox)

This commit is contained in:
4DBug committed 2026-10-31 15:22:07 -05:00
commit 242e38c4fe
36 files changed
+5171 -7

No files matched your search

+44 -1
View File
@@ -1,7 +1,7 @@
-- Throughput (bash tools/bench.sh): codec MB/s under both runtimes. MB/s are of decompressed output, best of n runs.
-- Fixtures: tools/fixtures/deflate.py (a 6 MB corpus), tools/fixtures/png.py (1024 x 768 images), tools/fixtures/mp3.py,
-- tools/fixtures/opus.py (3 s stereo files; MB/s of f32 output, 48 kHz stereo f32 is 0.384 MB/s of real time),
-- tools/fixtures/flac.py; wav encodes / decodes a generated tone; zstd / brotli / bzip2 / lzma (*_bench corpora), fonts
-- tools/fixtures/flac.py; wav encodes / decodes a generated tone; zstd / brotli / bzip2 / lzma / lz4 (*_bench corpora), .Z (tools/fixtures/z.py), fonts
-- (glyphs per second), json / xml / yaml, jpeg / gif / tiff / qoi / tga / pnm / hdr and ImageOps.
local Deflate = require("@formats/codecs/compress/Deflate")
local Crc32 = require("@formats/core/Crc32")
@@ -236,6 +236,19 @@ do
Zstd.decompress(z19, nil, nil, { verify = false })
end)
end
do
local Lz4 = require("@formats/codecs/compress/Lz4")
local LB = require("@tests/gen/lz4_bench")
local lz = buffer.fromstring(LB.data)
local raw = assert(Lz4.decompress(lz, nil, nil, LB.size))
assert(Crc32.of(raw) == LB.crc, "lz4 bench corpus mismatch")
bench("lz4 block decompress (hc9)", 5, LB.size, function()
Lz4.decompress(lz, nil, nil, LB.size)
end)
bench("lz4 block compress", 3, LB.size, function()
Lz4.compress(raw)
end)
end
do
local Brotli = require("@formats/codecs/compress/Brotli")
local BB = require("@tests/gen/brotli_bench")
@@ -254,6 +267,36 @@ do
Bzip2.decompress(bz)
end)
end
do
local Lz4F = require("@formats/archive/lz4")
local LF = require("@tests/gen/lz4frame")
local LC = require("@tests/gen/lz4frame_corpora")
local frameData
for _, c in LF.cases do
if c.name == "text/BX" then
frameData = buffer.fromstring(c.data)
end
end
bench("lz4 frame decode (64K, xxh32)", 5, #LC.text, function()
Lz4F.decompress(frameData)
end)
local tb = buffer.fromstring(LC.text)
bench("lz4 frame encode (xxh32)", 5, #LC.text, function()
Lz4F.compress(tb)
end)
end
do
local UnixCompress = require("@formats/codecs/compress/UnixCompress")
local ZC = require("@tests/gen/z")
local zc = ZC.cases[5] -- the 700 KB corpus, -b 16
local zb, zi = buffer.fromstring(zc.z), buffer.fromstring(zc.input)
bench(".Z decompress (lzw -b16)", 5, #zc.input, function()
UnixCompress.decompress(zb)
end)
bench(".Z compress (lzw -b16)", 3, #zc.input, function()
UnixCompress.compress(zi)
end)
end
do
local Lzma = require("@formats/codecs/compress/Lzma")
local LB = require("@tests/gen/lzma_bench")