merge ws/arch2: cpio ar/deb rpm .Z lz4 iso lha arj zoo cab, uu/yenc/binhex/macbinary/applesingle, d64 adf fat, bdf pcf psf fon type1 eot hershey

This commit is contained in:
4DBug committed 2026-10-31 16:44:01 -05:00
commit b5cdd77a5b
115 files changed
+17373 -29

No files matched your search

+80 -2
View File
@@ -1,8 +1,8 @@
-- 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 / lz4 (*_bench corpora), fonts
-- (glyphs per second), json / xml / yaml, jpeg / gif / tiff / qoi / tga / pnm / hdr and ImageOps.
-- 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), cab (LZX / MSZIP / Quantum), 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")
local Bytes = require("@formats/core/Bytes")
@@ -301,6 +301,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")
@@ -1138,6 +1168,54 @@ do
jitTune(false)
end
end
-- ws-arch2 archives: the LHA family (codecs/compress/Lzh) over tools/fixtures/lha.py archives (MB/s of output)
do
local Lha = require("@formats/archive/lha")
local LF = require("@tests/gen/lha")
for _, want in { "lha114i -h2 -5", "lha114i -h2 -7", "lengths/lh1-1m.lzh", "lengths/lz5-1m.lzs", "larc333/long.lzs" } do
for _, c in LF.cases do
if c.name == want then
local a = Lha.decode(Bytes.reader(buffer.fromstring(c.data))) :: any
local total = 0
for _, e in a:list() do
total += e.size
end
bench("lha " .. want, 3, total, function()
for _, e in a:list() do
a:read(e.name)
end
end)
end
end
end
end
-- ws-arch2 cabinets: LZX (codecs/compress/Lzx), Quantum (codecs/compress/Quantum) and MSZIP folders of
-- tools/fixtures/cab.py (MB/s of output; each run decodes the cabinet again, so the folder cache does not count)
do
local Cab = require("@formats/archive/cab")
local CF = require("@tests/gen/cab")
for _, kind in { "lzx", "quantum", "mszip" } do
local datas, total = {}, 0
for _, c in CF.cases do
local a = Cab.decode(Bytes.reader(buffer.fromstring(c.data))) :: any
if a and a.meta.folders[1].method == kind and #c.data > 20000 then
table.insert(datas, buffer.fromstring(c.data))
for _, e in a:list() do
total += e.size
end
end
end
bench("cab " .. kind .. " (" .. #datas .. " cabinets)", 5, total, function()
for _, d in datas do
local a = Cab.decode(Bytes.reader(d)) :: any
for _, e in a:list() do
a:read(e.name)
end
end
end)
end
end
do
-- game formats (ws-game): PKWARE DCL explode (StormLib's implode streams from tools/fixtures/mpq.py), reading every
-- file of a StormLib MPQ (MB/s of file data), Freedoom's MAP01 to a Scene (tools/fixtures/wad.py: sector