ELSEIF
Your brief EB
303 stories from 73 feeds 89 clusters Refreshed 14 minutes ago next pull 13:35

PERFORMANCE Signal 420

The LuaJIT NYI That Silently Poisoned an Unrelated Hot Loop

A LuaJIT NYI triggered by using unpack inside a pcall can cause the JIT compiler to blacklist a function, making an unrelated hot loop run in the interpreter and produce large performance swings.

WHY IT MATTERS

Engineers relying on LuaJIT for predictable speed may see their hot code paths intermittently fall back to interpretation without any obvious source change. This nondeterministic slowdown can waste compute resources and complicate performance testing. Guarding against the pattern or detecting NYI usage in CI helps maintain stable performance.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

The unpack operation inside a pcall is a LuaJIT NYI that triggers trace stitching and loses the pcall frame context.

02

When the trace recorder later returns through the lost frame, it blacklists the enclosing function from further compilation.

03

Any subsequent hot loop that calls that blacklisted function runs in the interpreter, causing large, unpredictable performance variations.

THE READ

What the cluster adds up to.

ORIGINAL ANALYSIS

Using unpack inside a pcall triggers a LuaJIT Not Yet Implemented condition. The tracer records the call but, because unpack cannot be compiled, it performs a stitch that loses the recorded pcall frame. When execution later returns through that missing frame, the tracer expects context that is no longer present.

The missing context causes the tracer to emit repeated "NYI: return to lower frame" messages and eventually marks the function as blacklisted. Once blacklisted, the function is no longer eligible for JIT compilation and runs in the interpreter.

An unrelated hot loop that repeatedly calls the blacklisted function therefore experiences intermittent slowdowns. Whether the loop is fast or slow depends on whether the trace that blacklisted the function has been formed, which can vary with small changes in execution history.

Because the slowdown originates from a seemingly innocuous line far from the hot loop, developers may spend time looking for performance bugs in the wrong place. The effect is not reproducible with minor code tweaks, making it hard to detect without examining trace logs or disabling the NYI pattern.

With only one source describing the issue, confidence in the exact failure mode is limited; corroboration from additional reports or independent reproductions would strengthen the conclusion. Teams can mitigate the risk by avoiding unpack inside pcall in performance-critical code or by adding CI checks that scan for the pattern and warn developers.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
Lobsters The LuaJIT NYI That Silently Poisoned an Unrelated Hot Loop Open ↗