On 14/06/2012, at 1:20 PM, Mike Pall wrote: > Yes, more or less. Inside the loop everything will be computed in > registers. There's still a 'point' allocation at the start of the > loop. And another 'point' object will be materialized from the > registers when the loop exits (it'll be eliminated if/when that > side trace is compiled eventually). Cool! Are the two allocations because the trace starts most likely starts on the "for i" rather than the line before and ends at the end of the loop? > BTW: That 'self.__index = self' line should be outside of the > allocation function. You're performing a write to the metatable > every time -- never do that! That's a performance hit even for > plain Lua, since it invalidates the negative metamethod cache. Thanks, I didn't know there *was* a cache. I don't think I do that in real life, but I will be wary. > Oh, and 'local point = {}' ... That one was so it worked when I pasted it to the command line to check it.