@@ -226,6 +226,22 @@ Recent fixes established additional rules for backend work. Follow these for all
226226 requirement: common optimized paths must not retain avoidable compiler-introduced allocation,
227227 dispatch, copying, or bookkeeping overhead.
228228
229+ ### Lua performance policy
230+
231+ * ** Wurst-emitted constructs are consumed by Wurst code.** Never add runtime coercion, nil guards,
232+ normalisation wrappers or other defensive code to emitted Lua whose justification is that foreign
233+ (non-Wurst) Lua might have mutated an emitted table, array or value. A user who bundles raw Lua that
234+ writes into Wurst-emitted structures owns the result. Typed arrays already carry a metatable that
235+ supplies the typed default; a read of a typed array is a raw table index and nothing else.
236+ * ** Leverage Lua-native mechanisms wherever semantics permit.** Prefer a metatable default over a
237+ read-site helper, an operator over a helper call, a fixed-arity function over a ` ... ` pack, and a
238+ direct table over an emulated hashtable. Emulating Jass limitations on Lua needs evidence that the
239+ limitation actually applies there.
240+ * ** A compiler-introduced call or allocation on an ordinary typed code path is a defect.** The
241+ optimiser must be able to inline small pure helpers; an analysis barrier that refuses to inline a
242+ function must be justified by what that function does, not by where else it happens to be called.
243+ * The concrete open items and their acceptance criteria are in ` LUA_HOT_PATH_SPEC.md ` .
244+
229245### Jass/Lua feature parity
230246
231247* New language/compiler features must be validated for ** both Jass and Lua** backends.
0 commit comments