bench.luau: rebuilt after the wave-1 merges (all workstreams' blocks)
This commit is contained in:
1 parent
2db77a7db8
commit
8e49c997ce
1 file changed
+78
-80
+78
-80
@@ -1,9 +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), zstd / brotli /
|
||||
-- bzip2 / lzma (their *_bench corpora) and fonts (glyph outlines + rasterization: glyphs per second).
|
||||
-- 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.
|
||||
-- tools/fixtures/flac.py; wav encodes / decodes a generated tone; zstd / brotli / bzip2 / lzma (*_bench corpora), fonts
|
||||
-- (glyphs per second), json / xml / yaml, jpeg / gif / tiff / qoi / tga / pnm / hdr and ImageOps.
|
||||
local Deflate = require("@formats/codecs/Deflate")
|
||||
local Crc32 = require("@formats/core/Crc32")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
@@ -71,79 +70,6 @@ do
|
||||
Png.encode(img)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ws-arch codecs: zstd, brotli, bzip2, xz / lzma
|
||||
do
|
||||
local Zstd = require("@formats/codecs/Zstd")
|
||||
local ZB = require("@tests/gen/zstd_bench")
|
||||
local z3, z19 = buffer.fromstring(ZB.data3), buffer.fromstring(ZB.data19)
|
||||
local zo = assert(Zstd.decompress(z3))
|
||||
assert(buffer.len(zo) == ZB.size and Crc32.of(zo) == ZB.crc, "zstd bench corpus mismatch")
|
||||
bench("zstd -3 (+ xxh64)", 3, ZB.size, function()
|
||||
Zstd.decompress(z3)
|
||||
end)
|
||||
bench("zstd -3 (no checksum)", 3, ZB.size, function()
|
||||
Zstd.decompress(z3, nil, nil, { verify = false })
|
||||
end)
|
||||
bench("zstd -19 (no checksum)", 3, ZB.size, function()
|
||||
Zstd.decompress(z19, nil, nil, { verify = false })
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Brotli = require("@formats/codecs/Brotli")
|
||||
local BB = require("@tests/gen/brotli_bench")
|
||||
local bz = buffer.fromstring(BB.data)
|
||||
local bout = assert(Brotli.decompress(bz))
|
||||
assert(buffer.len(bout) == BB.size and Crc32.of(bout) == BB.crc, "brotli bench corpus mismatch")
|
||||
bench("brotli decompress (q9 w22)", 5, BB.size, function()
|
||||
Brotli.decompress(bz)
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Bzip2 = require("@formats/codecs/Bzip2")
|
||||
local BZ = require("@tests/gen/bzip2_bench")
|
||||
local bz = buffer.fromstring(BZ.data)
|
||||
bench("bzip2 decompress -9", 3, BZ.size, function()
|
||||
Bzip2.decompress(bz)
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Lzma = require("@formats/codecs/Lzma")
|
||||
local LB = require("@tests/gen/lzma_bench")
|
||||
local lx, la = buffer.fromstring(LB.xz), buffer.fromstring(LB.alone)
|
||||
local lo = assert(Lzma.xz(lx))
|
||||
assert(buffer.len(lo) == LB.size and Crc32.of(lo) == LB.crc, "lzma bench corpus mismatch")
|
||||
bench("xz -6 (lzma2 + crc64)", 3, LB.size, function()
|
||||
Lzma.xz(lx)
|
||||
end)
|
||||
bench("lzma alone -6", 3, LB.size, function()
|
||||
Lzma.alone(la)
|
||||
end)
|
||||
end
|
||||
|
||||
-- fonts: outlines and rasterization (MB/s here = thousands of glyphs per second)
|
||||
do
|
||||
local Ttf = require("@formats/font/ttf")
|
||||
local FX = require("@tests/gen/fonts")
|
||||
for _, c in FX.fonts do
|
||||
if c.name == "Roboto-Medium" or c.name == "SourceSans3-Regular" then
|
||||
local f = assert(Ttf.decode(Bytes.reader(buffer.fromstring(c.data))))
|
||||
local gl = {}
|
||||
for cp = 33, 126 do
|
||||
table.insert(gl, f:glyphIndex(cp))
|
||||
end
|
||||
bench(c.name .. " outlines (kglyph/s)", 3, #gl * 1000, function()
|
||||
for _, g in gl do
|
||||
f:outline(g)
|
||||
end
|
||||
end)
|
||||
bench(c.name .. " rasterize 32 px (kglyph/s)", 3, #gl * 1000, function()
|
||||
for _, g in gl do
|
||||
f:rasterize(g, 32)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
for _, name in { "l3_cbr128_js", "l3_vbr_v2_48k", "l2_192_st" } do
|
||||
for _, c in MC do
|
||||
if c.name == name then
|
||||
@@ -220,6 +146,80 @@ do
|
||||
Xml.encode(doc)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ws-arch codecs: zstd, brotli, bzip2, xz / lzma
|
||||
do
|
||||
local Zstd = require("@formats/codecs/Zstd")
|
||||
local ZB = require("@tests/gen/zstd_bench")
|
||||
local z3, z19 = buffer.fromstring(ZB.data3), buffer.fromstring(ZB.data19)
|
||||
local zo = assert(Zstd.decompress(z3))
|
||||
assert(buffer.len(zo) == ZB.size and Crc32.of(zo) == ZB.crc, "zstd bench corpus mismatch")
|
||||
bench("zstd -3 (+ xxh64)", 3, ZB.size, function()
|
||||
Zstd.decompress(z3)
|
||||
end)
|
||||
bench("zstd -3 (no checksum)", 3, ZB.size, function()
|
||||
Zstd.decompress(z3, nil, nil, { verify = false })
|
||||
end)
|
||||
bench("zstd -19 (no checksum)", 3, ZB.size, function()
|
||||
Zstd.decompress(z19, nil, nil, { verify = false })
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Brotli = require("@formats/codecs/Brotli")
|
||||
local BB = require("@tests/gen/brotli_bench")
|
||||
local bz = buffer.fromstring(BB.data)
|
||||
local bout = assert(Brotli.decompress(bz))
|
||||
assert(buffer.len(bout) == BB.size and Crc32.of(bout) == BB.crc, "brotli bench corpus mismatch")
|
||||
bench("brotli decompress (q9 w22)", 5, BB.size, function()
|
||||
Brotli.decompress(bz)
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Bzip2 = require("@formats/codecs/Bzip2")
|
||||
local BZ = require("@tests/gen/bzip2_bench")
|
||||
local bz = buffer.fromstring(BZ.data)
|
||||
bench("bzip2 decompress -9", 3, BZ.size, function()
|
||||
Bzip2.decompress(bz)
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Lzma = require("@formats/codecs/Lzma")
|
||||
local LB = require("@tests/gen/lzma_bench")
|
||||
local lx, la = buffer.fromstring(LB.xz), buffer.fromstring(LB.alone)
|
||||
local lo = assert(Lzma.xz(lx))
|
||||
assert(buffer.len(lo) == LB.size and Crc32.of(lo) == LB.crc, "lzma bench corpus mismatch")
|
||||
bench("xz -6 (lzma2 + crc64)", 3, LB.size, function()
|
||||
Lzma.xz(lx)
|
||||
end)
|
||||
bench("lzma alone -6", 3, LB.size, function()
|
||||
Lzma.alone(la)
|
||||
end)
|
||||
end
|
||||
|
||||
-- fonts: outlines and rasterization (MB/s here = thousands of glyphs per second)
|
||||
do
|
||||
local Ttf = require("@formats/font/ttf")
|
||||
local FX = require("@tests/gen/fonts")
|
||||
for _, c in FX.fonts do
|
||||
if c.name == "Roboto-Medium" or c.name == "SourceSans3-Regular" then
|
||||
local f = assert(Ttf.decode(Bytes.reader(buffer.fromstring(c.data))))
|
||||
local gl = {}
|
||||
for cp = 33, 126 do
|
||||
table.insert(gl, f:glyphIndex(cp))
|
||||
end
|
||||
bench(c.name .. " outlines (kglyph/s)", 3, #gl * 1000, function()
|
||||
for _, g in gl do
|
||||
f:outline(g)
|
||||
end
|
||||
end)
|
||||
bench(c.name .. " rasterize 32 px (kglyph/s)", 3, #gl * 1000, function()
|
||||
for _, g in gl do
|
||||
f:rasterize(g, 32)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
do
|
||||
local Yaml = require("@formats/data/yaml")
|
||||
local YB = require("@tests/gen/yaml_bench")
|
||||
@@ -230,6 +230,8 @@ do
|
||||
end)
|
||||
bench("yaml encode", 3, #YB.text, function()
|
||||
Yaml.encode(v)
|
||||
end)
|
||||
end
|
||||
-- ------------------------------------------------------------------------------------------------ jpeg (ws-imgA)
|
||||
do
|
||||
local Jpeg = require("@formats/image/jpeg")
|
||||
@@ -255,7 +257,6 @@ do
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- ---------------------------------------------------------------------------------------- ws-imgA: gif + quantize
|
||||
do
|
||||
local Gif = require("@formats/image/gif")
|
||||
@@ -298,7 +299,6 @@ do
|
||||
Gif.encode(photo)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ ops/ImageOps
|
||||
do
|
||||
local Ops = require("@formats/ops/ImageOps")
|
||||
@@ -327,7 +327,6 @@ do
|
||||
Ops.composite(img, other)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ image/tiff (ws-imgA)
|
||||
do
|
||||
local Tiff = require("@formats/image/tiff")
|
||||
@@ -351,7 +350,6 @@ do
|
||||
Tiff.decode(Bytes.reader(enc16))
|
||||
end)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ imgA-simple: qoi / tga / pnm / hdr
|
||||
-- fixtures: tools/fixtures/qoi.py (tests/gen/qoi_bench.luau: run python3 -I tools/fixtures.py qoi first)
|
||||
do
|
||||
|
||||
Reference in new issue
Block a user