|
Jim Whitehead II wrote:
On Wed, Dec 1, 2010 at 8:53 PM, Lorenzo Donati <lorenzodonatibz@interfree.it> wrote:
[snip]
1. I discovered "late in the game" that the most efficient way to append an item to an array was a[#a+1]=item and not table.insert(a,item)Strictly speaking, isn't the fastest method: local tbl = {} local c = 0 c = c + 1 tbl[c] = item It's a micro benchmark, but I believe this was the winner. - Jim
Ouch! Yes. I implicitly assumed in my example that "a" was local. But that local c = 0 is a typo? Shouldn't it be local c = #tbl ?