[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Loop optimization for pairs and ipairs
- From: Sean Conner <sean@...>
- Date: Tue, 7 Jun 2022 17:04:22 -0400
It was thus said that the Great Xmilia Hermit once stated:
> I want to share a patch to optimize for-in loops for the pairs and
> ipairs case. It is inspired by LuaJITs ITERN optimization and a similar
> optimization in Luau.
> It works by checking in the OP_TFORPREP opcode for the pairs and ipairs
> case and use the to-be-closed slot for an index variable in the pairs
> and a marker in the ipairs case.
Is this safe? I ask because I use the to-be-closed slot in a C module
 for use with pairs.