lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On 30 Mar 2018, at 0.19, Duane Leslie <parakleta@darkreality.org> wrote:
> Well it is constant, but I was wrong about the small.  All of this cost is in the `__newindex` method, what happens if you take out the error checking (I only added that as an afterthought for parity with your described behaviour)?  I also wonder if using `self[] = mmax(self[], k)` is faster than the if-then.
> 
> Out of curiosity, using your benchmarks at what size table does the native length operation exceed my manual lookup metamethod?

I don’t understand where you are getting at with the Lua version of arrays. Pure Lua arrays will always be much slower than a native implementation.

I suggest you do the testing yourself, the code is there in github.

Petri