diff --git a/src/Formats/host/init.luau b/src/Formats/host/init.luau index ed78da2..3852922 100644 --- a/src/Formats/host/init.luau +++ b/src/Formats/host/init.luau @@ -39,5 +39,12 @@ elseif name == "luajit" then else host = require("@formats/host/Luau") end +-- LuaJIT (plain or LÖVE): the big decoders (Opus CELT, H.264, ...) outgrow the default 1000 traces / 8 MB of machine +-- code and fall back to the interpreter (CELT runs about 2.5x faster with these limits). Raising the limits only +-- allows more traces; set _G.FORMATS_NO_JIT_TUNE = true before requiring the library to leave them alone. +if G.jit ~= nil and type(G.jit.opt) == "table" and not G.FORMATS_NO_JIT_TUNE then + pcall(G.jit.opt.start, "maxtrace=8000", "maxmcode=65536") +end + local _ = Err return host diff --git a/tests/compat.luau b/tests/compat.luau index 837d994..48163b3 100644 --- a/tests/compat.luau +++ b/tests/compat.luau @@ -280,10 +280,10 @@ do -- float reads: NaNs with a payload come back as the canonical NaN (LuaJIT: n buffer.writeu32(b, 12, 0xfff12345) local a, i, c = buffer.readf32(b, 0), buffer.readf32(b, 4), buffer.readf64(b, 8) t:eq(type(a), "number", "f32 NaN payload is a number") - t:ok(a ~= a, "f32 NaN payload reads as NaN") + t:check(a ~= a, "f32 NaN payload reads as NaN") t:eq(i, math.huge, "f32 +inf") t:eq(type(c), "number", "f64 NaN payload is a number") - t:ok(c ~= c, "f64 NaN payload reads as NaN") + t:check(c ~= c, "f64 NaN payload reads as NaN") buffer.writeu32(b, 8, 0) buffer.writeu32(b, 12, 0xfff00000) t:eq(buffer.readf64(b, 8), -math.huge, "f64 -inf")