lua-users home
lua-l archive

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


On 29 Mar 2018, at 13.01, Duane Leslie <parakleta@darkreality.org> wrote:
> 
> They do have different semantics, but I believe you can implement everything you've proposed directly in Lua with equivalent performance (some small constant overhead for the VM) except maybe for the resize function.

“Equivalent performance”? “Small constant overhead"? Please.

Here are the relevant benchmarks using regular Lua tables, your Lua emulated arrays (with bugs fixed) and native arrays:

Running benchmarks using tables...
Insert           0.390144s
Push             2.439730s
Length           2.207718s

Running benchmarks using Lua emulated arrays...
Insert           2.492200s
Push             3.522455s
Length           0.643619s

Running benchmarks using native arrays...
Insert           0.313242s
Push             0.436351s
Length           0.134404s

Petri