|
On Tue, Jun 16, 2015 at 1:53 PM, Soni L. <fakedme@gmail.com> wrote:I'm assuming based on documentation/other thread, and also this: the opcodes indicate "local x do x = function() end end" loads "nil" into x, then changes x later, so LuaJIT can't just assume "x" is constant/immutable so instead it uses an indirect jump when you call x. with "local x = (function(...) return function() end end)(...)" there's a call opcode but x doesn't get implicitly nil-ed before it.On 16/06/15 05:42 PM, Brigham Toskin wrote:I'm curious if you've actually dumped the traces to see this difference, or if you're assuming it will do this based on documentation or some other thread on the subject?
This seems like exactly the kind of situation the tracing compiler might excel at optimizing "properly". Though that argument's moot if in fact it doesn't. Might be worth checking out, for those people that use blocks like this a lot.--Brigham Toskin